Technical data
Appendix
27.6 Sample Programs
Programming with STEP 7
672 Manual, 05/2010, A5E02789666-01
27.6.4.5 Example of Disabling and Enabling Interrupts and Asynchronous Errors
(SFC39 and SFC40)
In this example of a user program, a program section is assumed that cannot be interrupted by
interrupts. For this program section, OB35 calls (time-of-day interrupt) are disabled using SFC 39
"DIS_IRT" and later enabled again using SFC 40 "EN_IRT".
SFC39 and SFC40 are called in OB1:
STL (OB1) Explanation
A M 0.0
S M 90.1
A M 0.1
S M 90.0
:
:
CALL SFC 39
MODE :=B#16#2
OB_NO :=35
RET_VAL :=MW 100
:
:
L PIW 100
T MW 200
L MW 90
T MW 92
:
:
CALL SFC 40
MODE :=B#16#2
OB_NO :=35
RET_VAL :=MW 102
A M 10.0
S M 190.1
A M 10.1
S M 190.0
:
:
Program section that can be interrupted without
problems:
Program section that must not be interrupted
by interrupts:
Disable and discard interrupts
Mode 2: disable individual interrupt OBs
Disable OB35
Enable interrupts
Mode 2: enable individual interrupt OBs
Enable OB35
Program section that can be interrupted without
problems: