Siemens SIMATIC S7-200 System Manual page 173

Programmable controller
Hide thumbs Also See for SIMATIC S7-200:
Table of Contents

Advertisement

Example: Interrupt Instructions
M
A
I
N
I
N
T
0
Example: Timed Interrupt for Reading the Value of an Analog Input
M
A
I
N
S
B
R
0
I
N
T
0
Network 1
//On the first scan:
//1. Define interrupt routine INT_0 to
//
be a falling-edge interrupt for I0.0
//2. Globally enable interrupts.
LD
SM0.1
ATCH
INT_0, 1
ENI
Network 2
//If an I/O error is detected,
//disable the falling-edge interrupt for I0.0.
//This network is optional.
LD
SM5.0
DTCH
1
Network 3
//When M5.0 is on,
//disable all interrupts.
LD
M5.0
DISI
Network 1
//I0.0 falling-edge interrupt routine:
//Conditional return based on an I/O error.
LD
SM5.0
CRETI
Network 1
//On the first scan, call subroutine 0.
LD
SM0.1
CALL
SBR_0
Network 1
//1. Set the interval for the timed interrupt 0 to 100 ms.
//2. Attach timed interrupt 0 (Event 10) to INT_0.
//3. Global interrupt enable.
LD
SM0.0
MOVB
100, SMB34
ATCH
INT_0, 10
ENI
Network 1
//Read the value of AIW4 every 100 ms
LD
SM0.0
MOVW
AIW4, VW100
S7-200 Instruction Set
Chapter 6
159

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents