Programming concepts
5.2 Elements of the user program
S7-200 SMART
System Manual, V2.3, 07/2017, A5E03822230-AF
107
●
Other blocks contain information for the CPU. You can choose to download these blocks
when you download your program:
–
System Block: The system block allows you to configure different hardware options for
the CPU.
–
Data Block: The DB stores the initial values for different variables (V memory) used by
your program.
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
Network 1
LD SM0.1
CALL SBR_0
On first scan, call subrou-
tine 0.
SBR 0
Network 1
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
Network 1
LD SM0.0
MOVW AIW4,VW100
Sample the value of analog
input AI4.