Building a Fieldbus ETS System Based on EASY Embedded PLC Chipset[Copy link]
TSI system (steam turbine status monitoring and protection system) and ETS system (steam turbine emergency trip system) are important equipment for thermal power plants to ensure the normal operation of steam turbines and generators, and are widely used in thermal power generation enterprises. In most current applications, these two systems are independent of each other. Generally, the TSI system is provided by a professional TSI equipment supplier, while the ETS system is built with a general PLC. But in fact, there are many connections between the two systems, and the output of the TSI system is often the input of the ETS system. If the two systems can be organically integrated, it can not only save costs, but also simplify the system structure, thereby improving reliability. In view of the above situation, our company selected Kewei's ESAY embedded PLC chip to build the core control module of the ETS system, and organically integrated it with our company's fieldbus TSI system through the CAN fieldbus, which perfectly solved many problems existing in the current ETS system. 1. Overall design EASY embedded PLC chip has two uart serial ports, one CAN interface and 32 IO pins. The CAN interface of the chip has loaded Kewei's CAN application layer protocol, which is a master-slave protocol with a communication rate of 160K. The MVCAN-2 CAN application layer protocol used by our company's TSI system is a multi-master structure protocol, and the communication rate can be 10K, 125K, 250K and 500K. Due to different protocols, the TSI system cannot directly use the CAN interface of the EASY embedded PLC chip to communicate with it. To solve this problem, the ETS control module is designed as a dual CPU structure. Use the 8-bit MCU P89V51RD2 and the independent CAN controller SJA1000 to expand another CAN communication port, load the MVCAN-2 protocol on this communication port, and realize the connection with the TSI system. The P89V51RD2 and the EASY embedded PLC chip exchange data through two IDT7202 chips. IDT7202 is a dual-port FIFO (first-in, first-out) buffer with an internal 1024×9-bit FIFO RAM. 2. Hardware Implementation The following is the main hardware design block diagram:
P89V51RD2 is connected to the write port of one IDT7202 through address, data and write signal lines, and is connected to the read port of another IDT7202 through address, data and read signal lines; the embedded PLC chip has only general IO pins, no address, data and read/write signal lines, and can only use general IO to simulate read and write operations. The specific method is to use the P1 port of the embedded PLC chip as an 8-bit data port to connect to the other set of read and write ports of the two IDT7202s respectively, P3.0, P3.1, and P3.2 are used as read, write, and enable signals, and P4.0, P4.1, and P4.2 are used as status judgment signals. The P2 port of the embedded PLC chip is used to expand 8 relay outputs, and the other interfaces and characteristics of the embedded PLC chip are designed according to typical applications. The UART serial port of P89V51RD2 is designed as an RS232 standard serial port, which is used to download the configuration file of the TSI system during setting, and load the MODBUS protocol during operation to communicate with the host computer or other devices. The final ETS controller has the following functions: eight relay outputs, one CAN interface interconnected with the TSI system, another CAN interface can be used for IO expansion and interconnection between ETS controllers, COM1 serial port is used for ladder diagram download and PLC monitoring, COM2 is used for CAN configuration and PLC communication, COM3 (expanded by P89V51RD2) is used for TSI configuration download and TSI data monitoring. 3. Software Implementation The software consists of two parts. One part is the software running in P89V51RD2, and the other part is the software embedded in the embedded PLC chip. The software running in P89V51RD2 is written in C language. The software is designed for two working modes: setting mode and working mode. In the setup mode, the user uses the PC to pass the configuration file of the TSI system to P89V51RD2 through the serial port, and P89V51RD2 stores the file in the internal FLASH; in the working mode, P89V51RD2 parses the TSI system data received by SJA1000 according to the configuration file, and transmits the data to the embedded PLC through IDT7202 in a certain format. At the same time, the data sent by the embedded PLC through IDT7202 is parsed and sent to the TSI system through SJA1000. The software embedded in the embedded PLC chip is written based on the assembly language framework provided by Kewei. First, we need to use general IO to simulate the read and write operations of IDT7202. The following is the program for reading and writing IDT7202: FIFO_FF EQU P4.1 FIFO_EF EQU P4.0 C1_DIR EQU P3.3 C1_EN EQU P3.2 C1_WR EQU P3.1 C1_RD EQU P3.0 FIFO_PORT EQU P1 WRITE_FIFO: MOV SFRPAGE,#0FH JNB FIFO_FF,WFIFO_L1 CLR C1_DIR MOV FIFO_PORT,R7 CLR C1_EN CLR C1_WR SETB C1_WR SETB C1_EN MOV R6,#1 RET WFIFO_L1: MOV R6,#0 RET READ_FIFO: MOV SFRPAGE,#0FH JNB FIFO_EF,RFIFO_L1 SETB C1_DIR CLR C1_EN CLR C1_RD MOV FIFO_PORT,#0FFH MOV A,FIFO_PORT SETB C1_RD SETB C1_EN MOV R6,A MOV R7,#1 RET RFIFO_L1: MOV R7,#0 RETRead the data of IDT7202 in the STEP function and SCAN function of the embedded PLC, and read two frames each time. After the data is parsed, it is stored in the corresponding D register, so that the data can be used in ladder diagram programming. Some of the data is writable (that is, it is allowed to be transferred from the PLC to the TSI direction). For this part of the data, a memory is opened in the external RAM of the PLC as a data copy. During initialization, the D register and the copy are set to the same value. During operation, monitor whether the values of the D register and the copy are the same in the STEP function and SCAN function. If they are different, send the D register value to P89V51RD2. 4. Conclusion The fieldbus ETS controller built based on the EASY embedded PLC chip has been actually used in industrial sites, and the overall situation is good. It should be said that EASY embedded PLC chip is a successful product.