Technical data
Appendix
27.3 Data Types and Parameter Types
Programming with STEP 7
Manual, 05/2010, A5E02789666-01 621
Example for Using the Parameter Type ANY
The following example shows how you can copy a memory area of 10 bytes using the parameter
type ANY and the system function SFC20 BLKMOV.
STL Explanation
FUNCTION FC10: VOID
VAR_TEMP
Source : ANY;
Target : ANY;
END_VAR
BEGIN
LAR1 P#Source;
L B#16#10;
T LB[AR1,P#0.0];
L B#16#02;
T LB[AR1,P#1.0];
L 10;
T LW[AR1,P#2.0];
L 22;
T LW[AR1,P#4.0];
L P#DBX11.0;
T LD[AR1,P#6.0];
LAR1 P#Target;
L B#16#10;
T LB[AR1,P#0.0];
L B#16#02;
T LB[AR1,P#1.0];
L 10;
T LW[AR1,P#2.0];
L 33;
T LW[AR1,P#4.0];
L P#DBX202.0;
T LD[AR1,P#6.0];
CALL SFC 20 (
SRCBLK := Source,
RET_VAL := MW 12,
DSTBLK := Target
);
END_FUNCTION
Load the start address of the ANY pointer in AR1.
Load the syntax ID and
transfer it to the ANY pointer.
Load data type Byte and
transfer it to the ANY pointer.
Load 10 bytes and
transfer them to the ANY pointer.
Source is DB22, DBB11
Load the start address of the ANY pointer in AR1.
Load the syntax ID and
transfer it to the ANY pointer.
Load data type Byte and
transfer it to the ANY pointer.
Load 10 bytes and
transfer them to the ANY pointer.
Target is DB33, DBB202
Call the system function BLKMOV
Evaluate the BR bit and MW12