Programming concepts
5.2 Elements of the user program
S7-200 SMART
System Manual, 09/2015, A5E03822230-AC
89
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
LD SM0.1
CALL SBR_0
On first scan, call subrou-
tine 0.
SBR 0
LD SM0.0
MOVB 100, SMB34
ATCH INT_0, 10
ENI
Set the interval to 100 ms
for the timed interrupt.
Enable interrupt 0.
INT 0
LD SM0.0
MOVW AIW4,VW100
Sample the value of analog
input AI4.