The following example shows a program that includes a subroutine and an interrupt routine.
This sample program uses a timed interrupt for reading the value of an analog input every
100 ms.
Table 5- 1
Sample program with a subroutine and an interrupt routine
Main
SBR 0
INT 0
S7-200 SMART
System Manual, 09/2015, A5E03822230-AC
5.2 Elements of the user program
Network 1
LD SM0.1
CALL SBR_0
Network 1
LD SM0.0
MOVB 100, SMB34
ATCH INT_0, 10
ENI
Network 1
LD SM0.0
MOVW AIW4,VW100
Programming concepts
On first scan, call subrou-
tine 0.
Set the interval to 100 ms
for the timed interrupt.
Enable interrupt 0.
Sample the value of analog
input AI4.
89