PLC Interrupt Instructions and Examples

1. Concept of Interrupts and Interrupt Events

PLC Interrupt Instructions and Examples

In our daily work, we follow a normal workflow. If an emergency occurs or we need to attend to another task after a certain period, we must first stop our current work to handle the emergency or the other task. This stopping of work is called an interrupt, and the emergency or other task being handled is called the interrupt program. After resolving the issue, we return to continue our original work.

Similarly, PLCs also have interrupts. The CPU normally executes a program, and if an action or parameter recognized by the system reaches a set requirement, the interrupt program is executed to handle the set program. After completion, it returns to continue executing the original program.

The PLC system has predefined some interrupt actions, such as when input points I0.0 or I0.1 are activated (rising edge) or deactivated (falling edge), or when the time relay’s set time has elapsed. These actions are called interrupt events. The PLC assigns a number to each interrupt event, known as the interrupt event number. For instance, when I0.0 is activated on the rising edge, it corresponds to event number “0”.

The program that is stopped to handle the task (the work content) is called the interrupt program.

The following image shows common interrupt events and their numbers:

PLC Interrupt Instructions and ExamplesPLC Interrupt Instructions and Examples

2. Interrupt Instructions

PLC Interrupt Instructions and Examples

PLC has been designed to process the above interrupt event instructions. The steps to process interrupt events are as follows:

1. Associate (Connect) the Interrupt Event Number with the Interrupt Program (Number)

The following image connects interrupt event number 1 (I0.0 falling edge) with interrupt program number INT1.

PLC Interrupt Instructions and Examples

2. Enable Interrupt Functionality

Since the PLC defaults to globally prohibiting interrupt processing, the interrupt functionality must be enabled. See the image below.

PLC Interrupt Instructions and Examples

3. Write the Interrupt Program, Detailing the Work Content to be Handled

The interrupt program can be renamed.

PLC Interrupt Instructions and Examples

Additionally, there are two other instructions: interrupt separation and interrupt clearing.

PLC Interrupt Instructions and Examples

3. Example Interrupt Program:

PLC Interrupt Instructions and Examples

The design requirement is to create a blinking output for indicator light Q0.0. When I0.0 is activated, the blinking frequency should be halved (slow blink), and when I0.1 is activated, it should blink quickly.

The design idea is to use timed interrupts SMB34 and SMB35 to set the blinking cycle for Q0.0, with a cycle of 100ms for fast blinking and 200ms for slow blinking. Upon checking, the interrupt event numbers for SMB34 and SMB35 are 10 and 11, respectively. The program is as follows:

PLC Interrupt Instructions and ExamplesPLC Interrupt Instructions and Examples

Interrupt Program INT0:

PLC Interrupt Instructions and Examples

Interrupt program for interrupt event 10.

Interrupt Program INT1:

PLC Interrupt Instructions and Examples

Interrupt program for interrupt event 11.

Summary:

PLC Interrupt Instructions and Examples

1. If you need to execute a new or change the original interrupt event, you must first separate the original event number from the interrupt program connection, then re-establish a new connection.

2. If there are multiple interrupt events to handle, they will be executed in order of priority, with those of the same priority handled first.

3. The simpler the interrupt program, the better.

Source: This article is reprinted from the internet, and the copyright belongs to the original author. If there are any copyright issues, please contact us for deletion. Thank you!

PLC Interrupt Instructions and Examples

Scan to Follow

WeChat ID|13615417996

Follow the QR code on the left for free access.

[Siemens Material Collection]

Leave a Comment