2024-07-03

What are the stages of the PLC execution process?

What are the stages of the PLC execution process?

What are the stages of the process introduced to the PLC executive program? In fact, in the whole operation process, the PLC CPU repeats the input, execution and output stages at a certain scanning speed. Completing these three stages is called a scan cycle.

PLC scanning process:

1. Input sampling phase

In this stage, the PLC reads input signals on all input terminals by scanning, and stores each input state into the corresponding input image register. At this point, the input image register is brushed off. During the program execution phase and the output refresh phase, the input image memory is isolated from the outside world and its contents remain unchanged until the input scan phase of the next scan cycle, when it is refreshed by the input signal that is re-read. It can be seen that when the PLC executes the program and processes the data, it does not directly use the input signal at the time of the scene, but uses the data input to the image area during this sampling. Generally speaking, the width of the input signal should be greater than one scan cycle, otherwise the signal may be lost.

2. Program execution stage

 

 

In the process of executing the user program, the PLC scans according to the ladder diagram program principle, in general, the PLC executes the program one by one from left to right and from top to bottom. However, when the program jump instruction is encountered, the program jump address is determined according to whether the jump condition is met. During the execution of the program, when the input and output states are involved in the instruction, the PLC “reads” the corresponding input terminal state from the input image register, and “reads” the current state of the corresponding component (” soft relay “) from the output image register. Then the corresponding operation is performed and the result is stored in the output image register. For the output image register, the state of each component (the “soft relay”) changes as the program executes.

3. Output refresh phase

The results of the program execution phase are stored in the output image area, and are not sent to the output port. In the output refresh stage, the PLC sends the output variables in the output image area to the output latch, and then the latch generates the control output of the cycle through the output module. If the status of the internal output relay is “1”, the output relay contact is closed and the external load is driven through the output terminal. The status of all output devices must be maintained for a scanning period.