Detailed description
2.14 Programming tips with STEP 7
Basic logic functions: PLC Basic program powerline (P3 pl)
Function Manual, 11/2006, 6FC5397-0BP10-2BA0
279
Example
FUNCTION_BLOCK FB 99 Comment
VAR_INPUT
varin: INT ;
END_VAR
VAR
variable1: ARRAY[0 to 9] of INT;
variable2: INT ;
END_VAR
BEGIN
L
P##variable1; //Pointer at start of ARRAY
//The value 8500 0010 is now in the accumulator
//and a cross-area pointer is in the AR2. If cross-area processing is to take
place, then an area should be skipped when these two pointers are added.
AD
DW#16#00FF_FFFF, //Skipping of an area
LAR1
//Load into AR1
TAR2;
+AR1 AR2;
//AR2 instance offset to be added
//The ARRAY of variable1 can now be accessed indirectly via AR1.
L
DIW [AR1, P#0.0]; //E.g., access to first element
END_FUNCTION_BLOCK