With the rapid development of microprocessors, computers and digital communication technologies, computer control has expanded to almost all industrial fields. Among them, PLC and single-chip microcomputer have been widely used in small-scale control systems.
In the automatic temperature control of plastic extruder, S7-200 series PLC is selected as the main control device, PIC16F877 single-chip microcomputer is used as temperature data acquisition and analog-to-digital conversion chip, and the single-chip computer transmits data to PLC through communication port, because RS-485 interface is adopted. Standard, transmission distance up to 1000m. The PLC controls the heating coil after the PID operation to keep the temperature constant. The following is an introduction to the communication implementation of PLC and MCU with examples.
2, hardware composition 2.1, PIC16F877 microcontrollerMicrochip's PIC16F877 microcontrollers feature Harvard bus architecture and reduced instruction set technology, featuring low power consumption, high operating speed, high drive capability, and compact external circuitry. The PIC16F877 microcontroller integrates a serial communication module, the universal synchronous/asynchronous transceiver USART module. The main application target is long-distance serial communication between systems. The two pins required by the USART module are RC6 and RC7. As shown in Figure 1, when the transmit enable bit, TXEN, is set, the transmit data can be written to the TXREG register to complete the transfer.
2.2, S7-200 series PLCThe S7-200 series PLC communication port adopts asynchronous serial communication mode. The communication port standard adopts balanced drive and differential acceptance RS485 interface standard, which can form a half-duplex serial communication network to form a distributed system. There can be up to 32 in the system. station. The S7-200 supports a variety of serial communication protocols. With the free port mode, the user-defined communication protocol can be implemented through statement list or ladder diagram programming, which is convenient for connecting smart devices from different manufacturers. In the free port mode, data within 255 bytes can be continuously transmitted or received, which is convenient in bulk data communication.
2.3, MAX485E chipThe MAX485E chip is a standard dedicated communication chip for the RS-485 interface. As shown in Figure 1, the RO pin is a data output pin. It receives the differential mode signal VAB of the RS-485 and converts it to a TTL level output by the RO. The RE pin is the RO. The enable terminal, strobe RO when low level, the output is valid. The DI pin is the data input terminal, which converts the TTL level data into the differential mode signal VAB, and is sent out by the A and B legs. The DE is the DI enable terminal, the high level strobe DI, and the input is valid. Therefore, the two legs A and B are both the RS-485 signal input terminal and the output terminal of the signal. The key is determined by the levels of the enable terminals RE and DE.
2.4, hardware connection diagramS7-200PLC adopts RS-485 interface standard to receive differential mode signal, while the output of PIC16F877 MCU is TTL level, so the two must be converted first when communicating. This system uses MAX485E chip as conversion chip, hardware connection is shown in Figure 1. Shown. The input or output of data is selected by the RC4 of the PIC16F877 microcontroller.
Figure 1 hardware connection diagram
3. Communication protocolIn this project, since the PIC16F877 MCU only sends data, the PLC simply receives data, so it uses simplex serial communication. The PLC adopts the free port mode protocol, and the protocol is implemented by the statement table programming; the single chip uses the asynchronous sending mode of the USART module, and the protocol is implemented by assembly language programming. It can be known from the transmission buffer structure of the PIC16F877 single-chip microcomputer that only two bytes of data can be continuously transmitted at a time, so it is convenient for the PLC to use the character reception completion interrupt. The interface standard adopts RS-485 which is consistent with the PLC side, the connector adopts 9-pin D-shaped connector, the transmission line adopts shielded twisted pair, and the transmission data of the MCU side needs to be converted and then sent.
The format of the character information is: 1 start bit, 8 data bits, no parity, 1 stop bit.
The character information format of asynchronous communication is shown in Figure 2.
Figure 2 Character information format
The data bits are sent in the order of the low order and the high order.
Transparent Led Film Screen P20
Since its establishment, it has been focusing on the application field of LED transparent flexible film screen. It is a high-tech enterprise integrating material development, circuit design, circuit production, product development, production, sales and service of LED transparent flexible film screen. The company is mainly engaged in LED transparent flexible film screen products, and currently launches P6, P8, P10, P20, P30, P40. Support customization to meet various application needs.China leading manufacturers and suppliers of Transparent Led Film Screen P20,Led Outdoor Advertising Screens, and we are specialize in Electronic Led Outdoor Advertising Display,Flexible Outdoor Led Mesh Screen, etc.
Transparent Led Film Screen P20,Led Outdoor Advertising Screens,Electronic Led Outdoor Advertising Display,Flexible Outdoor Led Mesh Screen
Guangdong Rayee Optoelectronic Technology Co.,Ltd. , https://www.rayeeled.com