The working process of the programmable controller consists of two parts: a fixed process of self-diagnosis and communication response, and a user program execution process.
Before each execution of the user program, the PLC executes the internal fixed program such as fault self-diagnosis program, reset, monitoring, timing, etc. If the self-diagnosis is normal, continue to scan downward, and then the PLC checks whether there is communication with the programmer, computer, etc. request. If there is a communication request with a computer or the like, the corresponding processing is performed. When the PLC is in the STOP state, only the first two processes are cycled.
When the PLC is in the RUN state, the PLC cycles through five working phases: internal processing, communication operation, input scanning, executing user program, and output refresh. The time required to complete each of the above five phases is called a scan cycle.
The scan cycle is an important indicator of the PLC. The scan cycle of a small PLC is generally from ten to several tens of milliseconds.
The length of the scan cycle of the PLC depends on the scan speed and the length of the user program. The scan time in milliseconds is usually allowed for general industrial equipment, and the short delay of the PLC to the input is also allowed. However, for devices that respond quickly to certain I/Os, appropriate actions should be taken. If you select a high-speed CPU, increase the scanning speed; select fast response module, high-speed counting module and different interrupt processing to reduce the lag time.
For the user, to improve the programming ability, optimize the program as much as possible; while writing the control program of the large device, minimize the program length, select the branch or jump program, etc., can reduce the user program execution time.