Siemens SIMATIC S7-200 System Manual page 169

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

Advertisement

Table 6-46
Interrupt Events, continued
Event
Description
22
Timer T96
23
Port 0
24
Port 1
25
Port 1
26
Port 1
27
HSC0
28
HSC0
29
HSC4
30
HSC4
31
HSC4
32
HSC3
33
HSC5
Understanding How the S7-200 Processes Interrupt Routines
The interrupt routine is executed in response to an associated internal or external event. Once the
last instruction of the interrupt routine has been executed, control is returned to the main program.
You can exit the routine by executing a Conditional Return from Interrupt instruction (CRETI).
Table 6-47 emphasizes some guidelines and restrictions for using interrupt routines in your
program.
Table 6-47
Guidelines and Restrictions for Using Interrupt Routines
Guidelines
Interrupt processing provides quick reaction to special internal or external events. You should optimize
interrupt routines to perform a specific task, and then return control to the main routine.
By keeping the interrupt routines short and to the point, execution is quick and other processes are not
deferred for long periods of time. If this is not done, unexpected conditions can cause abnormal operation of
equipment controlled by the main program. For interrupts, the axiom, ''the shorter, the better,'' is definitely true.
Restrictions
You cannot use the Disable Interrupt (DISI), Enable Interrupt (ENI), High-Speed Counter Definition (HDEF),
and End (END) instructions in an interrupt routine.
System Support for Interrupts
Because contact, coil, and accumulator logic can be affected by interrupts, the system saves and
reloads the logic stack, accumulator registers, and the special memory bits (SM) that indicate the
status of accumulator and instruction operations. This avoids disruption to the main user program
caused by branching to and from an interrupt routine.
Sharing Data Between the Main Program and Interrupt Routines
You can share data between the main program and one or more interrupt routines. Because it is
not possible to predict when the S7-200 might generate an interrupt, it is desirable to limit the
number of variables that are used by both the interrupt routine and elsewhere in the program.
Problems with the consistency of shared data can result due to the actions of interrupt routines
when the execution of instructions in your main program is interrupted by interrupt events. Use the
local variable table of the interrupt routine to ensure that your interrupt routine uses only the
temporary memory and does not overwrite data used somewhere else in your program.
CT=PT interrupt
Receive message complete
Receive message complete
Receive character
Transmit complete
Direction changed
External reset
CV=PV
(current value = preset value)
Direction changed
External reset
CV=PV
(current value = preset value)
CV=PV
(current value = preset value)
S7-200 Instruction Set
CPU 221
CPU 224
CPU 222
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Chapter 6
CPU 224XP
CPU 226
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
155

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents