Technical data

Appendix
27.6 Sample Programs
Programming with STEP 7
Manual, 05/2010, A5E02789666-01 665
Code Section
Enter the following STL user program in the code section of OB20:
STL (OB20) Explanation
Network 1
SET
= Q 4.0
Network 2:
L QW 4
T PQW 4
Network 3:
L #STARTINFO.T_STMP.SECONDS
T MW 140
L #STARTINFO.T_STMP.MSEC_WDAY
T MW 142
L MD 140
SRD 4
T MD 140
Network 4:
L #STARTINFO.SIGN
T MW 144
Network 5:
CALL SFC 20
SRCBLK := STARTINFO
RET_VAL := MW 106
DSTBLK := P#M 120.0 Byte 20
Set output Q 4.0 unconditionally
Activate output word immediately
Read seconds from start event information
Read milliseconds and day of week from start
event information
Eliminate day of week and
write milliseconds back (now BCD-coded in MW
142)
Read starting time of time-delay interrupt (=
call SFC32) from start event information
Copy start event information to memory area
(MB120 to MB139)