Detailed explanation of PLC interrupt function

Publisher:EtherealJourneyLatest update time:2024-03-26 Source: elecfansKeywords:PLC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

PLC understands the interrupt function in this way. When understanding the interrupt, we must first understand the PLC's operation cycle or scan cycle. It is necessary to talk about the process of PLC sequential control cycle execution. This is the premise for understanding the interrupt and must be mastered. It is divided into three parts: input processing, program processing, and output processing.

d0b6aad4-5dab-11ee-939d-92fbcf53809c.jpg

1. Input processing: Before executing a program, the programmable controller reads the ON/OFF status of all input terminals of the programmable controller into the input image area. Even if the input changes during program execution, the content of the input image area will not change. The change is read when executing the input processing of the next cycle.

2. Program processing, PLC reads the ON/OFF status of each soft element from the input image area and the image area of ​​other soft elements according to the instruction content in the program memory, and then starts the calculation from step 0 in sequence, and writes the results obtained each time into the image area. Therefore, the image area of ​​each soft element gradually changes its content as the program is executed. In addition, the internal contacts of the output relay perform actions according to the content of the output image area.

3. Output processing: After all instructions are executed, the ON/OFF status in the output Y image area will be transmitted to the output latch memory, which will serve as the actual output of the programmable controller.

The time required to execute an action is the operation cycle, also called scan time. So what is the connection between interrupts and scan cycles? Interrupts are not executed in a complete order from top to bottom. Instead, the interrupt program takes priority and runs the program processing alone and outputs immediately without participating in the entire cycle operation.

What is the role of interrupt? We know that the scan cycle of PLC is very short, so it is difficult for us to see the sequential control execution process of PLC. Here we may as well assume that the scan cycle is 10s, that is, it takes 10s to execute the entire program. There is a very simple program LD X0, OUT Y0. According to the above figure, when X0 is ON, Y0 does not output immediately, but waits until 10s before outputting. After disconnecting X0, Y0 is also not closed immediately. Both need to be scanned before there is a result. In this way, in our actual application, PLC is useless and the device cannot work. At this time, interrupt processing is required. Use the input interrupt function to execute the input immediately. In fact, the operation time of PLC is very short, only a few milliseconds, which can fully meet the needs, but some things such as high-frequency pulse input and pulse capture, which are in microseconds, will definitely be affected by periodic operations.

Therefore, if you need to complete many ON/OFF state processing in one cycle, you must use the interrupt function. In general, we rarely use interrupts. Even if we need them, the high-speed instructions of the PLC have interrupt functions, so there is no need to write interrupt subroutines. For example, the high-speed counter uses interrupts to process the high-speed pulses from a specific input relay, so it can count regardless of the operation time. The counting result is either output immediately using a comparison instruction dedicated to the high-speed counter, or the high-speed counter interrupt method is used to execute specific program processing on the count value of the high-speed counter.

High-speed counters are not used to count high-frequency pulses. We use the interrupt function to count high-speed inputs. The example is as follows: from EI to FEND is the main program, and from pointer I101 (interrupt pointer of input X0) to IRET is the interrupt subroutine. Whenever the rising edge of X1 is sensed, the subroutine is executed to transfer the value to D10 immediately, thus avoiding the influence of the PLC operation cycle.

d0c672c0-5dab-11ee-939d-92fbcf53809c.jpg


Keywords:PLC Reference address:Detailed explanation of PLC interrupt function

Previous article:About the universal formula of PLC analog quantity
Next article:30 Basic Knowledge of Frequency Converter (Part 3)

Recommended ReadingLatest update time:2024-11-16 09:37

Communication module implementation scheme in different PLC modes
1. Implemented through routing mode If two PLCs belong to different network segments and have data communication needs, the most typical application is to achieve it through routing mode. On the PLC side, you need to enable the "use router" function, fill in the corresponding gateway address, and then call the
[Embedded]
Communication module implementation scheme in different PLC modes
How to display timer time in Mitsubishi PLC
Mitsubishi PLC (Programmable Logic Controller) is a device widely used in the field of industrial automation. Timer is a basic function in PLC, which is used to realize delay control, timing control and other functions. In Mitsubishi PLC, the display and setting of timer is very important. The following will introdu
[Embedded]
PLC control circuit for sequential start/stop of two motors
The PLC control circuit diagram is as follows: PLC control l/O allocation table is as follows: The ladder diagram is as follows: The specific startup process is: When the start button sB2 of the motor M1 is pressed, it sets ×2 in pLc to 1, that is, the contact is connected, so t
[Embedded]
PLC control circuit for sequential start/stop of two motors
Programmable Controller PLC XC3-32RT-E Parameter Description
XC series PLC model description takes XC3-32RT-E as an example: XC3——serial number, 32——I/O points, RT——output type (R stands for relay/T stands for transistor), E/C——Indicates power supply (E indicates 220v AC power supply/C indicates 24v DC power supply) Expansion module model description, taking XC
[Embedded]
Working principle of PLC programmer
Programmable Logic Controller, or PLC for short, is an electronic controller based on an electronic computer and suitable for industrial field work. It is derived from a relay control device, but unlike a relay device, it does not achieve control through the physical process of the circuit, but mainly relies on runn
[Embedded]
Using Atmel89c2051 to simulate PLC control method
Using Atmel89c2051 to simulate PLC control can combine the advantages of microcontroller control and PLC control. As the core technology of embedded systems, microcontroller control has high reliability and cost-effectiveness, and is compact and low-cost. The ladder diagram programming in PLC control is similar to the
[Microcontroller]
Using Atmel89c2051 to simulate PLC control method
Method of measuring analog signal by using high-speed counter in S7-200PLC
1. Analog quantity acquisition requires a good signal environment, including good power supply for sensors and instruments! Try to avoid strong power cables and high, medium and low frequency interference in analog quantity transmission lines, such as: high frequency welding pipe machine, medium frequency heating fu
[Embedded]
Introduction to Siemens PLC Common Instructions
1. Bit Logic Instructions 1. Contact and coil instructions Programming principles of PLC ladder diagram language 1. The ladder diagram consists of multiple rungs. Each coil can constitute a rung. Each rung has multiple branches, and each rung represents a logic equation. 2. The relays, contacts a
[Embedded]
Introduction to Siemens PLC Common Instructions
Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号