What is Interrupt? Interrupt 1. Stop the continuous progress of (an activity or process). 2. Interrupts alter a program s flow of control. Interrupts are basically events that require immediate attention by the PLC. When an interrupt event occurs the PLC pause its current task and attend to the interrupt by executing an Interrupt Service Routine (ISR) at the end of the ISR the PLC returns to the task it had pause and continue its normal operations. The interrupt routines that are associated with the interrupt events are stored as part of the program. Note :- The interrupt routines are not executed as part of the normal scan cycle, but are executed when the interrupt event occurs (which could be at any point in the scan cycle).
Interrupts are serviced by the S7-200 on a first-come-firstserved basis within their respective priority assignments. The Enable Interrupt instruction (ENI) globally enables processing of all attached interrupt events. The Disable Interrupt instruction (DISI) globally disables processing of all interrupt events.
Conditional Return from Interrupt The Conditional Return from Interrupt instruction (CRETI) can be used to return from an interrupt, based upon the condition of the preceding logic. Attach Interrupt The Attach Interrupt instruction (ATCH) associates an interrupt event EVNT with an interrupt routine number INT and enables the interrupt event.
Detach Interrupt The Detach Interrupt instruction (DTCH) disassociates an interrupt event EVNT from all interrupt routines and disables the interrupt event.
Interrupt Description 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 to associate an interrupt event (specified by the interrupt event number) and the program segment (specified by an interrupt routine number). 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. You can disable individual interrupt events by breaking the association between the interrupt event and the interrupt routine with the Detach Interrupt instruction. The Detach Interrupt instruction returns the interrupt to an inactive or ignored state.
Types of Interrupts Supported by the S7-200 The S7-200 supports the following types of interrupt routines: Communications port interrupts: The S7-200 generates events that allow your program to control the communications port. I/O interrupts: The S7-200 generates events for different changes of state for various I/O. These events allow your program to respond to the high-speed counters, the pulse outputs, or to rising or falling states of the inputs. Time-based interrupts: The S7-200 generates events that allow your program to react at specific intervals.
Communications Port Interrupts The serial communications port of the S7-200 can be controlled by your program. This mode of operating the communications port is called Freeport mode. In Freeport mode, your program defines the baud rate, bits per character, parity, and protocol. The Receive and Transmit interrupts are available to facilitate your program-controlled communications. Refer to the Transmit and Receive instructions for more information.
I/O Interrupts I/O interrupts include rising/falling edge interrupts, highspeed counter interrupts, and pulse train output interrupts. The S7-200 can generate an interrupt on rising and/or falling edges of an input (either I0.0, I0.1, I0.2, or I0.3). The rising edge and the falling edge events can be captured for each of these input points. These rising/falling edge events can be used to signify a condition that must receive immediate attention when the event happens.
Time-Based Interrupts After being enabled, the timed interrupt runs continuously, executing the attached interrupt routine on each expiration of the specified time interval.
Interrupt Table
Interrupt table based on the Priority
How to Program an Interrupt with Ladder Logic? Lets suppose we use an interrupt which is occur on the rising edge of I0.0. 1. The Attach Interrupt instruction (ATCH) associates an interrupt event EVNT with an interrupt routine number INT and enables the interrupt event. 2. The Enable Interrupt instruction (ENI) globally enables processing of all attached interrupt events 3. Next we write a specific Program in INT0 subroutine. This Program executes when specific interrupt occurs. After the instruction we use (RETI) instruction to Return back to the program where it lefts.