P3: Basic PLC Program for SINUMERIK 840D sl
13.13 Block descriptions
Basic Functions
Function Manual, 09/2011, 6FC5397-0BP40-2BA0
975
After a successful FB-5 call the writing can be done via the returned address of the FB 5 parameter ("VarToken")
with the help of FB3.
Call example 2
Read a GUD variable from channel 1 with the name "GUD_STRING" (type definition of the variables: STRING
with length 30 bytes). The user-defined variable should be converted in a 10-byte variable pointer for subsequent
writing with the FB 3.
Call and parameterization of FB 5 with instance DB 111:
U I 7.7; //Unassigned machine control panel key
S M 100.0; //Activate req.
U M 100.1; //Done completed message
R M 100.0; //Terminate job
U I 7.6; //Manual error acknowledgment
U M 102.0; //Error pending
R M 100.0; //Terminate job
CALL FB 5, DB 111 (
Req := M 100.0, //Starting edge for reading
Area := B#16#2, //Channel variable
Unit := B#16#1, //Channel 1
Index1 := 0, //No field index
Index2 := 0, //No field index
CnvtToken := TRUE, //Conversion into 10-byte token
VarToken := DB_GUDVAR.GUDVar1Token,
Error := M 102.0,
Done := M 100.1,
State := MW 104
RD := P#DB99.DBX0.0 DINT 1 // free memory area
);
CALL FB 3, DB 112 (
Req := M 200.0,
NumVar := 1, //Write 1 GUD variable
Addr1 := DB_GUDVAR.GUDVar1Token,
Error := M 102.0,
Done := M 100.1,
State := MW 104
SD1 := P#DB99.DBX0.0 DINT 1);
// Data block for GUD variable
DATA_BLOCK DB_GUDVAR //Assignment to symbol table
STRUCT
GUDVarS : STRING[32] := 'GUD_STRING'; //Name is defined by user
GUDVarSToken :