The essence of PLC is a kind of computer specialized in industrial control, whose hardware structure is basically the same as that of microcomputer.
1. The central processing unit (CPU) is the control center of PLC. It receives and stores user programs and data typed from the programmer according to the functions given by PLC system program; checks the status of power supply, memory, I/O and alert timer, and can diagnose syntax errors in user programs. When PLC is put into operation, firstly, it receives the status and data of each input device on site by scanning, and stores them respectively in I/O image area, then read the user programs one by one from the user program memory, after the command explanation, execute the logic or arithmetic according to the instructions and send the result into the I/O image area or data register. After all the user programs are executed, the output states of the I/O image area or the data in the output register are finally transmitted to the corresponding output device, so that the loop runs, until it stops running.
In order to further improve the feasibility of PLC, in recent years, dual CPU is adopted to form redundant system for large PLC, or three CPU voting system is adopted. In this way, even if a CPU fails, the whole system can still run normally.
2. Memory storage the memory of system software is called System program memory. The memory for storing application software is called user program memory.
Frequently used memory types of PLC
(1) RAM (Random Assess Memory) this is a kind of read/write Memory (Random Memory), which has the fastest access speed and is supported by lithium battery.
(2) EPCA (Erasable Programmable Read Only Memory) this is a kind of Erasable Read-Only Memory. In the case of power failure, all contents in the memory remain unchanged. (The content of the memory can be erased under the continuous ultraviolet radiation ).
(3) eepca (Electrical Erasable Programmable Read Only Memory) this is a kind of electroerasable Read-Only Memory. You can easily modify the stored content by using the programmer.
Distribution of PLC storage space
Although the maximum addressing space of CPU of various PLC is different, according to the working principle of PLC, its storage space generally includes the following three areas:
(1) system program storage area
(2) system RAM storage area (including I/O image area and system soft equipment, etc)
(3) User program storage area System program storage area: System program equivalent to computer operating system is stored in the system program storage area. Including monitoring program, management program, command interpretation program, function subprogram, system diagnosis subprogram, etc. The manufacturer solidifies it in EPCA, and users cannot access it directly. It and hardware together determine the performance of the PLC.
System RAM storage area: system RAM storage area includes I/O image area and various soft devices, such as logic coil, data register, timer, counter, addressing register, accumulator and other memories.
(1) I/O image area: after PLC is put into operation, all input states and data are read in sequence only in the input sampling stage, the output status and data are sent to the corresponding peripherals during the output refresh phase. Therefore, it requires a certain number of storage units (RAM) to store the status and data of I/O. These units are called I/O image areas. A switch I/O occupies a bit in the storage unit, and an analog I/O occupies a word (16 bits) in the storage unit ). Therefore, the entire I/O image area can be regarded as two parts: switching value I/O image area and analog value I/O image area.
(2) storage area of system soft equipment: in addition to I/O image area, storage area of system RAM also includes all kinds of soft equipment inside PLC (logic coil, timer, counter, data register and accumulator, etc) the storage area. This storage area is divided into storage area with power loss retention and storage area without power loss retention. When PLC is powered off, the former is powered by internal lithium battery, and the data will not be lost; when the PLC is powered off, the data is reset.
1) the output of logic coil is the same as that of the switch. Each logic coil occupies a position in the RAM storage area of the system, but it cannot directly drive the peripherals. It is only used by users in the programming process, its function is similar to the relay in the electrical control circuit. In addition, different PLC also provides different numbers of special logic coils with different functions.
2) data registers are the same as analog I/O, and each data register occupies one word (16 bits) in the RAM storage area of the system ). In addition, PLC also provides different numbers of special data registers with different functions.
3) Timer
4) counter
User program storage area
User program storage area stores user programs compiled by users. Different types of PLC have different storage capacities.
3. Power supply
The power supply of PLC plays a very important role in the whole system. If there is no good and attainable power supply system, it can't work normally, so PLC manufacturers also attach great importance to the design and manufacture of power supply. Generally, when the fluctuation of AC voltage is within the range of + 10% (+ 15%), PLC can be directly connected to AC power grid without other measures.