Full analysis of the PLC user program execution process

Full analysis of the PLC user program execution process

PLC user program execution plays a vital role in device control. It achieves precise control of various devices by processing input signals, executing user programs, and outputting control signals.

4 min readContent reviewed

Detail

PLC adopts centralized processing in the process of user program execution, which processes the three stages of input scanning, user program execution and output refresh in batches. In the input scanning stage, PLC reads the input signals on all input terminals in a scanning manner and stores them in the input image area. For example, in digital input/output processing, when digital input is usually used to receive switch signals, such as limit switches, buttons, etc. these signals are read and stored in the input scanning stage to provide a data basis for subsequent program execution.

In the stage of executing user programs, PLC scans and executes one by one from top to bottom and from left to right in the order of ladder diagram programs. For example, during program execution, PLC takes out the current state of input variables from the input image area, performs logical operations or other operations, and then stores the operation results in the corresponding internal relays. This process is like an orderly production line, operating according to the established procedures and sequence.

In the output refresh phase, the PLC sends the output variables in the output image area to the output latch, and then the latch generates the control output of this cycle through the output module. For example, when the state of the output relay is "1", the output relay contact is closed, driving the corresponding output device to work.

This centralized processing feature enables the PLC to efficiently process a large number of input and output signals, and ensures the stability and reliability of the system. At the same time, the working mode of different stages also enables the PLC to respond to changes in input signals in a timely manner, thereby achieving precise control of the equipment.

In the input scanning phase, the PLC scans and reads the input signals on all input terminals in an efficient and orderly manner. This process is like a careful observer who does not miss any details. When the PLC reads the input signals, it will store them in the input image area, and the input image memory will be refreshed. In the program execution phase and the output refresh phase, the input image memory is like an independent fortress, isolated from the outside world, and its content remains unchanged. This ensures that during the execution of the program, the PLC always uses the data input into the image area during this sampling, rather than directly using the input signal at the time of the scene. This method provides a reliable data basis for the stable execution of the program.

The state of the input device has a direct impact on the internal input relay. If the input device can form a closed loop at the PLC input terminal, then the internal input relay corresponding to the input terminal number is saved as "1", which is equivalent to the relay coil being turned on. During the execution of the program, the contact corresponding to the number will act. On the contrary, if the input device makes the input open circuit, the internal input relay is saved as "0", which is equivalent to the relay coil not being turned on, and the corresponding contact will not act. This clear correspondence enables the PLC to accurately control the execution path of the program according to the input signal.

PLC often fails to collect input signals of less than ten milliseconds. This is because the input scan of PLC has a certain cycle. If the duration of the input signal is very short, such as less than one scan cycle, then the signal may not be captured during the input scan stage. Specifically, when the input signal appears, if it is not in the input scan stage, then the signal cannot be read in. Only when the duration of the input signal is greater than one scan cycle can it be ensured that it will be collected by PLC during the input scan stage. For example, some fast pulse signals, if their width is less than the scan cycle of PLC, are likely to be missed, thus affecting the system's response to certain rapidly changing input states.

Sourcing help

Send the BOM for one quote covering active stock, EOL stock and cross-references.

Need a quote for this part?

Send us the part number or article link — we will confirm price, availability and lead time.

WhatsApp us

Related Articles

Back to blog