The working principle and operation mode of PLC controller are explained in detail

Date:2022-06-02 09:26

The working principle and operation mode of PLC controller detailed PLC controller refers to programmable logic controller (PLC), which is a digital electronic device with a microprocessor, a digital logic controller for automatic control, which can load control instructions into memory at any time for storage and execution.

PLC controller is widely used in the field of industrial control, the following explains the working principle and operation mode of PLC controller:

 

The working principle of the PLC controller

I. Scanning technology

When the PLC is put into operation, its working process is generally divided into three stages, namely input sampling, user program execution and output refresh. Completing these three phases is called a scan cycle. Throughout the operation, the PLC's CPU repeats the above three stages at a certain scanning speed.

 

1. Input sampling stage In the input sampling stage

The PLC reads in all input states and data sequentially in a scan mode and stores them in the corresponding units in the I/O image area. After the input sampling is completed, it moves on to the user program execution and output refresh phase. In both phases, even if the input state and data change, the state and data of the corresponding cells in the I/O image area do not change. Therefore, if the input is a pulsed signal, the width of the pulsed signal must be greater than one sweep period to guarantee that the input can be read in any case.

 

2. User program execution stage

During the user program execution phase, the PLC always scans the user program (ladder diagram) sequentially from top to bottom. When scanning each ladder diagram, the control line composed of each contact on the left side of the ladder is always scanned first, and the control line composed of contacts is logically calculated in the order of first left and then right, first up and then down, and then refreshes the status of the corresponding bit of the logic coil in the system RAM memory area according to the results of the logical operation; or refresh the status of the corresponding bit of the output coil in the I/O image area; Or determine whether you want to execute the special function instructions specified by the ladder.

 

That is, during the execution of the user program, only the status and data of the input point in the I/O image area will not change, while the status and data of other output points and soft devices in the I/O image area or system RAM storage area may change, and the ladder diagram ranked above, the program execution results will work on the ladder diagram of all coils or data used below; In contrast, the ladder below the state or data of the logic coil that is refreshed can only be used for the program above it until the next scan cycle.

 

If immediate I/O instructions are used during program execution, I/O points can be accessed directly. Even if the I/O instruction is used, the value of the input process image register will not be updated, the program will take the value directly from the I/O module, and the output process image register will be updated immediately, which is somewhat different from immediate input.

 

3. Output refresh stage

When the scanning user program is completed, the PLC enters the output refresh phase. During this period, the CPU refreshes all output latch circuits according to the corresponding status and data in the I/O image area, and then drives the corresponding peripherals through the output circuit. At this time, it is the real output of the PLC.

 

How the PLC controller works

Although many relays, timers and counters are often used in the ladder diagram program used by PLCs, the PLC does not have these hardware internally, but does logic control editing in memory and program programming, and connects external mechanical devices to do physical control through output components. Therefore, the hardware space required by the controller can be greatly reduced. In fact, the PLC executes the ladder diagram program operation mode line by line, first reading the ladder diagram code into the CPU in a scanning mode, and finally performing the control operation. The whole scanning process consists of three steps, "Input Status Check", "Program Execution", and "Output Status Update" are described as follows:

 

Step 1 "Input Status Check":P LC first checks the status of each point switch or sensor connected to the input element (1 or 0 represents on or off), and writes its status to the corresponding position Xn in memory.

 

Step 2 "Program Execution": Take the ladder diagram program into the CPU line by line for operation, if the program execution needs to enter the contact status, the CPU directly queries and retrieves it from memory. The operation result of the output coil is stored in the corresponding position in the memory, and it is not reflected to the output Yn.

 

Step 3 "Output Status Update": Update the output status in step 2 to the PLC output contact and return to step 1. This three steps is called the scanning cycle of the PLC, and the time required to complete is called the reaction time of the PLC, and if the PLC input signal time is less than this reaction time, there is a possibility of misinterpretation. After each program execution and before the next program execution, the output and input states are updated once, so this operation method is called the output input "program end regeneration".