Specifications

SIMATIC Instructions
9-165
S7-200 Programmable Controller System Manual
C79000-G7076-C233-01
9.16 SIMATIC Interrupt and Communications Instructions
Attach Interrupt, Detach Interrupt
The Attach Interrupt instruction associates an interrupt
event (EVNT) with an interrupt routine number (INT), and
enables the interrupt event.
The Detach Interrupt instruction disassociates an
interrupt event (EVNT) from all interrupt routines, and
disables the interrupt event.
Attach Interrupt: Error conditions that set ENO = 0:
SM4.3 (run-time), 0006 (indirect address)
Inputs/Outputs Operands Data Types
INT Constant (CPU 222: 0-12, 19-23, 27-33; CPU 224: 0-23, 27-33) BYTE
EVNT Constant (CPU 222: 0-12, 19-23, 27-33; CPU 224: 0-23, 27-33) BYTE
Understanding Attach and Detach Interrupt Instructions
Before an interrupt routine can be invoked, an association must be established
between the interrupt event and the program segment that you want to execute
when the event occurs. Use the Attach Interrupt instruction (ATCH) to associate an
interrupt event (specified by the interrupt event number) and the program segment
(specified by an interrupt routine number). You can attach multiple interrupt events
to one interrupt routine, but one event cannot be concurrently attached to multiple
interrupt routines. When an event occurs with interrupts enabled, only the last
interrupt routine attached to this event is executed.
When you attach an interrupt event to an interrupt routine, that interrupt is
automatically enabled. If you disable all interrupts using the global disable interrupt
instruction, each occurrence of the interrupt event is queued until interrupts are
re-enabled, using the global enable interrupt instruction.
You can disable individual interrupt events by breaking the association between the
interrupt event and the interrupt routine with the Detach Interrupt instruction
(DTCH). The Detach instruction returns the interrupt to an inactive or ignored state.
Table 9-20 lists the different types of interrupt events.
L
A
D
S
T
L
ATCH INT, EVENT
DTCH EVENT
ATCH
EN
INT
EVNT
DTCH
EN
EVNT
F
B
D
ENO
ENO
222 224
333
221