Technical data

Appendix
27.6 Sample Programs
Programming with STEP 7
Manual, 05/2010, A5E02789666-01 673
27.6.4.6 Example of the Delayed Processing of Interrupts and Asynchronous Errors
(SFC41 and SFC42)
In this example of a user program, a program section is assumed that cannot be interrupted by
interrupts. For this program section, interrupts are delayed using SFC41 "DIS_AIRT" and later
enabled again using SFC42 "EN_AIRT."
SFC41 and SFC42 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 41
RET_VAL :=MW 100
L PIW 100
T MW 200
L MW 90
T MW 92
:
:
:
CALL SFC 42
RET_VAL :=MW 102
L MW 100
DEC 1
L MW 102
<>I
JC err
A M 10.0
S M 190.1
A M 10.1
S M 190.0
:
:
BEU
err: L MW 102
T QW 12
Program section that can be interrupted without
problems:
Program section that must not be interrupted
by interrupts:
Disable and delay interrupts
Enable interrupts
The number of set interrupt disables is in the
return value
The number of set interrupt disables is in the
return value
The number must have the same value after the
interrupt is enabled
as before the interrupt disable (here "0")
Program section that can be interrupted without
problems:
The number of set interrupt disables is
displayed