Technical data
Appendix
27.6 Sample Programs
Programming with STEP 7
Manual, 05/2010, A5E02789666-01 667
Code Section
Enter the following STL user program in the code section of OB1:
STL (OB1) Explanation
Network 1
L #STARTINFO.T_STMP.SECONDS
T MW 10
L #STARTINFO.T_STMP.MSEC_WDAY
T MW 12
L MD 10
SRD 4
T MD 10
Network 2:
A I 0.0
FP M 1.0
= M 1.1
Network 3:
A M 1.1
JNB m001
CALL SFC 32
OB_NO := 20
DTME := T#10S
SIGN := MW 12
RET_VAL:= MW 100
m001: NOP 0
Network 4:
CALL SFC 34
OB_NO := 20
RET_VAL:= MW 102
STATUS := MW 4
Network 5:
A I 0.1
FP M 1.3
= M 1.4
Network 6:
A M 1.4
A M 5.2
JNB m002
CALL SFC 33
OB_NO := 20
RET_VAL:= MW 104
m002: NOP 0
A I 0.2
R Q 4.0
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 12)
Positive edge at input I 0.0?
If so, start time-delay interrupt (starting time
of time-delay interrupt assigned to the parameter
SIGN)
Query status of time-delay interrupt (SFC
QRY_DINT)
Positive edge at input I 0.1?
...and time-delay interrupt is activated (bit 2
of time-delay interrupt STATUS)?
Then cancel time-delay interrupt
Reset output Q 4.0 with input I 0.2