5-16
S7-200 Programmable Controller, CPU 210
C79000-G7076-C235-01
Interrupt Example
Network 1
LD
I0.1
A
M0.0
TON
T0, +0
EU
MOVW
+0, MW2
ENI
Network 2
LD
SM0.0
S
M0.0, 1
Network 3
LDW>= T0, +50
DISI
R
M0.0, 1
Network 4
LD
M0.0
JMP
0
Network 5
LDN
M0.0
A
I0.1
AW>=
MW2, +14550
AW<=
MW2, +15200
=
Q0.0
Network 6
LBL
0
Network 7
MEND
Network 8
INT
0
Network 9
INCW
MW2
Network 10
RETI
Ladder
STL
Main Program
RETI
Network 1
Network 2
MOV_W
EN
IN
OUT
+0
MW2
ENI
Network 3
END
Network 5
I0.1
SM0.0
Network 9
INC_W
EN
IN
OUT
MW2
MW2
Network 10
M0.0
TON
IN
PT
T0
P
+0
M0.0
S
1
Network 1: Turn on timer T0, enable the
interrupt routine, and initialize the counter
variable (MW2).
Network 2: Turn the timer on after it has
been turned off.
Network 3: After 5 seconds, turn off the
timer and disable the interrupt routine.
Network 4: While the timer is executing,
jump over the logic that tests the number
of counts.
Network 5: If timer has stopped, turn on
Q0.0 if the number of counts is between
14550 and 15200.
T0
>=I
+50
DISI
Network 4
JMP
0
M0.0
M0.0
R
1
/
M0.0
MW2
>=I
+14550
I0.1
MW2
<=I
+15200
Q0.0
Network 7
Network 8
INT
0
Network 6
LBL
0
Network 6: Destination for the jump
instruction (Network 4).
Network 7: End of the main program
segment.
Network 8: Identifies the high-speed
counter interrupt routine. This interrupt
routine can count up to 3 kHz.
Network 9: Increments the counter (MW2)
for each positive transition of I0.0.
Network 10: Returns to the main program
segment.
Interrupt Routine
Figure 5-12 Using an Interrupt Routine to Provide a High-Speed Counter
Instruction Set
Summary of Contents for Simatic S7-200 CPU 210
Page 10: ...x S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 Contents ...
Page 116: ...A 16 S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 CPU 210 Data Sheets ...
Page 126: ...F 2 S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 CPU 210 Order Numbers ...
Page 138: ...Index 12 S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 Index ...