laitimes

An article will give you a thorough explanation of the interrupt function of the PLC

author:Jicheng PLC classroom

The interrupt function is often used in PLC programs, interrupts are equivalent to subprograms, and subprograms are equivalent to main programs. IN OTHER WORDS, IT IS LIKE TELLING PULSE PROCESSING, WITHOUT INTERRUPTION, ONLY 1MS TIMING CAN ACHIEVE ITS FUNCTION, BUT IT IS NOT AS ACCURATE AS INTERRUPTING TIMING, AFTER ALL, THERE IS NO INTERRUPTION, AND THE PROGRAM SCAN IS BOUND BY THE SCANNING CYCLE.

However, there are some programs that must use interrupts, typically PID, and the detection and read cycle must be accurate. Regardless of whether the PID interrupt program was programmed by itself in the past, or the PID interrupt program block is now integrated, precise time control is used to deal with the interrupt of the information immediately.

In today's article, let's talk about how to use the PLC interrupt function?

PLC understands the interrupt function in this way, when understanding the interrupt, we must first be clear about the PLC operation cycle or the scanning cycle, it is necessary to say that the PLC sequential control cycle execution process, which is the premise of understanding the interrupt, must be mastered, divided into three parts, input processing, program processing, output processing.

An article will give you a thorough explanation of the interrupt function of the PLC

1. Input processing

Before executing the program, the programmable controller reads the ON/OFF status of all input terminals of the programmable controller into the input image area, and even if the input changes during the program execution, the contents of the input image area do not change, and the change is read when the input processing of the next cycle is executed.

2. Program processing

According to the instruction content in the program memory, the plc reads the ON/OFF status of each software component from the input image area and the image area of other software components, and then starts the calculation from step 0 in turn, and writes the result obtained each time to the image area. Therefore, the image area of each soft component gradually changes its contents as the program is executed, and the internal contacts of the output relay perform actions according to the contents of the output image area.

3. Output processing

After all instructions are executed, the ON/OFF state in the output Y image area is transferred to the output latch memory, which is the actual output of the programmable controller.

The time required to execute an action is the operation period, also called the scanning time, so what is the relationship between the interrupt and the scanning cycle, the interrupt is not in the complete execution from top to bottom, but the interrupt program is preferentially run separately and is an immediate output that does not participate in the whole cycle operation.

What is the function of the interruption, we know that the plc scanning cycle is very short, so it is difficult for us to see the plc sequential control execution process, here we might as well assume that the scanning cycle is 10s time, that is, it takes 10s to execute all the programs, there is a very simple program LD X0, OUT Y0, according to the above figure when X0 is ON, Y0 is not immediately output, but wait until 10s to output, after disconnecting X0, the same Y0 is not immediately closed, It needs to be scanned before the result is obtained. Then in our practical application, the PLC will not be able to work without using the equipment, and then it is necessary to interrupt the processing, and the input interrupt function is used 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 times such as high-frequency pulse input and pulse capture in microseconds must be affected by periodic operation.

Therefore, if you want to complete the ON/OFF state process many times in a cycle, you must use the interrupt function. For example, the high-speed counter uses the interrupt mode to process the high-speed pulse from the specific input relay, so no matter how much the operation time is, the counting result is either output immediately using the special comparison instruction of the high-speed counter, or the counting value of the high-speed counter is interrupted by the high-speed counter to execute a specific program processing.

For example, from EI to FEND is the main program, starting from pointer I101 (the interrupt pointer of input X0) to IRET is an interrupt subroutine, and whenever the rising edge of X1 is sensed, the subroutine is executed to immediately transfer the value to D10, so as to avoid the influence of the plc calculation cycle.

An article will give you a thorough explanation of the interrupt function of the PLC

Disclaimer: This article is transferred from the Internet, the copyright belongs to the original author, if it involves the copyright of the work, please contact us to delete it in time, thank you!

How can I get more information about electrical hot topics?

Here's how to do it!

An article will give you a thorough explanation of the interrupt function of the PLC

Read on