Technical data
Appendix
27.6 Sample Programs
Programming with STEP 7
Manual, 05/2010, A5E02789666-01 659
STL Code Section
Enter the following STL user program in the code section of OB10:
STL (OB10) Explanation
Network 1
L #STARTINFO.T_STMP.MSEC_WDAY
L W#16#F
AW
T #WDAY
Network 2:
L #WDAY
L 2
<>I
JC mond
Network 3:
L D#1995-1-27
T #IN_DATE
L TOD#20:0:0.0
T #IN_TIME
SET
= Q 4.0
JU cnvt
mond: L D#1995-1-23
T #IN_DATE
L TOD#5:0:0.0
T #IN_TIME
CLR
= Q 4.0
cnvt: NOP 0
Network 4:
CALL FC 3
IN1 := #IN_DATE
IN2 := #IN_TIME
RET_VAL := #OUT_TIME_DATE
Network 5:
CALL SFC 28
OB_NO := 10
SDT := #OUT_TIME_DATE
PERIOD := W#16#1201
RET_VAL := MW 200
A BR
= M 202.1
Select day of week
and store.
If day of week is not Monday, then specify
Monday, 5.00 am as next starting time and reset
output Q 4.0.
Otherwise, if day of week is Monday, specify
Friday, 8.00 pm (20.00) as next starting time
and set output Q 4.0.
Starting time specified.
Convert specified starting time to format
DATE_AND_TIME (for SFC28).
Set time-of-day interrupt.
Network 6:
CALL SFC 30
OB_NO := 10
RET_VAL := MW 204
A BR
= M 202.2
Network 7:
CALL SFC 20
SRCBLK := #STARTINFO.T_STMP
RET_VAL := MW 206
DSTBLK := P#M 100.0 BYTE 8
Activate time-of-day interrupt.
Block transfer: save time of day from start
event information of OB10 to the memory area
MB100 to MB107.