Specifications
Basic Concepts for Programming an S7-200 CPU
4-19
S7-200 Programmable Controller System Manual
C79000-G7076-C233-01
AIW4 VW100
SM0.1
Network 1
Network 1
100 SMB34
SM0.0
INT0
ATCH
EN
EVNT10
Network 1
IN
MOV_W
OUT
EN
SIMATIC LAD
ENI
MAIN PROGRAM OB1
SUBROUTINE 0
INTERRUPT ROUTINE 0
SBR0
EN
ENO
SM0.0
ENO
IN
MOV_B
OUT
EN ENO
Figure 4-7 SIMATIC LAD Program for Using a Subroutine and an Interrupt Routine
Network 1
LD SM0.1 //When first scan cycle
//bit comes on
CALL 0 //Call subroutine 0.
Network 1
LD SM0.0 //Always on memory bit.
MOVB 100, SMB34 //Set timed interrupt 0
//interval to 100 ms.
AENO //If move is successful,
ATCH 0, 10 //attach timed interrupt 0
//to interrupt routine 0.
AENO //If attach is successful,
ENI //then enable Global Interrupt.
//Begin interrupt routine 0.
Network 1
LD SM0.0 //Always on memory bit.
MOVW AIW4,VW100 //Sample Analog Input 4.
Statement List
Main Program OB1
Subroutine 0
Interrupt Routine 0
Figure 4-8 SIMATIC STL Program for Using a Subroutine and an Interrupt Routine