Interrupt And Communications Instructions - Siemens Simatic S7-200 System Manual

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

Advertisement

Instruction Set

10.14 Interrupt and Communications Instructions

Interrupt Routine, Return from Interrupt Routine
L
A
D
S
INT
T
L
CRETI
RETI
212
214
Interrupt Routines
You can identify each interrupt routine by an interrupt routine label that marks the entry point
into the routine. The routine consists of all your instructions between the interrupt label and
the unconditional return from interrupt instruction. The interrupt routine is executed in
response to an associated internal or external event. You can exit the routine (thereby
returning control to the main program) by executing the unconditional return from interrupt
instruction (RETI), or by executing a conditional return from an interrupt instruction. The
unconditional return instruction is always required.
Interrupt Use 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
Restrictions for using the interrupt routine follow:
Put all interrupt routines after the end of the main ladder program.
You cannot use the DISI, ENI, CALL, HDEF, FOR/NEXT, LSCR, SCRE, SCRT, and END
instructions in an interrupt routine.
You must terminate each interrupt routine by an unconditional return from interrupt
instruction (RETI).
System Support for Interrupt
Because contact, coil, and accumulator logic may 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.
10-114
The Interrupt Routine instruction marks the beginning of the
n
interrupt routine (n).
INT
The Conditional Return from Interrupt instruction may be
used to return from an interrupt, based upon the condition of the
RETI
preceding logic.
The Unconditional Return from Interrupt coil must be used to
terminate each interrupt routine.
RETI
Operands:
n
215
216
n:
0 to 127
S7-200 Programmable Controller System Manual
C79000-G7076-C230-02

Advertisement

Table of Contents
loading

Table of Contents