1. PLC execution process

1. PLC execution process

PLC executes programs written by users in a loop, with each loop called a scan, and the time consumed by each scan is called a scan cycle.

This series of compiled PLCs is more efficient than traditional solutions, reflected in shorter scanning cycles.

1.1. Excute process

Process Description
Read input 1) The CPU copies the numerical value of the physical input to the X register group. 2) The CPU copies the analog input from the physical input to the AI register group.
Execution program 1) The CPU executes the program, and the instructions inside the program will work or not according to the input conditions.
Write output 1) The CPU applies the data from the Y register group to the physical output of digital quantities. 2) The CPU applies the data from the AO register group to the physical output of analog signals.

1.2. Execute user program

During the execution phase of the scanning cycle, the CPU executes the main program, starting from the first instruction and continuing to execute until the last instruction. During the execution of the main program or interrupt routine, immediate I/O instructions (LDIM/OutIM/SetIM/RSTIM) can be used to access inputs and outputs immediately.

Subroutines can be called in the main program, and subroutines can also be called in interrupt programs to form nested programs. There is no limit on the number of nested programs, but there is a memory usage limit. If the memory usage exceeds the limit, the PLC will report an error.

If interrupts are used in a program, the interrupt event trigger must call this interrupt program. At any stage in the RUN state, as soon as an event triggers, the interrupt program is executed immediately.