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.
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.
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
- Popular Resources
- Popular amplifiers
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Unboxing
- Programming Techniques in FPGA Design
- TMS320F28335 and its minimum system design
- 2022 Digi-Key Innovation Design Competition + ESP32-S2-KALUGA1 Unboxing
- Defensive C Programming in Embedded Development
- MSP CapTIvate MCU Development Kit Evaluation Model
- Please tell me, what is the difference between NB-IOT module and NB-IOT chip, what additional features and functions does the former have over the latter?
- 【Home treasure】 esp32s2 freertos communication between tasks Event Groups
- View Circuit-ADC and System (2)
- Hi3559A Flying Camera Solution