Serial communication between single-chip microcomputer and PLC to achieve - Communication design applications -

by:Coolmay     2020-06-28
1, the preface as the microprocessor, the rapid development of computer and digital communication technology, computer control has been extended to almost all industrial fields. Among them, the PLC and single-chip microcomputer in small-scale control system widely used.

in the plastic extruder temperature automatic control, choose S7 - 200 series PLC as the master device, PIC16F877 single-chip microcomputer as the temperature data acquisition and modulus conversion chip and MCU through the communication port to transmit data to the PLC, due to the adopted RS - 485 interface standards, transmission distance up to 1000 m. PLC control after the PID operation to heat circle to maintain a constant temperature. Combined with the example below, we give the introduction of PLC controller and MCU communication.

2, hardware. 1, the PIC16F877 single-chip microcomputer PIC16F877 single-chip microcomputer Microchip company adopts the technology of the harvard bus structure and reduced instruction set, with low power consumption, high speed, driving ability strong and the characteristics of simple external circuit. PIC16F877 single chip microcomputer internal serial communication module which is integrated in the general synchronous/asynchronous transceiver USART module, the main application target is the long-distance serial communication between the system. USART module for two pins is RC6 and RC7, as shown in figure 1, when sending allows a TXEN to be 1, can send data to register TXREG sent to complete.

2。 2、S7- PLCS7-200 series 200 series PLC communication port USES asynchronous serial communication mode, communication port accept standard adopts balance drive, difference of RS485 interface standard, can form a half duplex serial communication network, a distributed system, there can be a maximum of 32 stations in the system. S7- 200 to support multiple serial port communication protocol, the use of free port mode, can through the statement table or ladder diagram programming, implement user-defined communication protocol, intelligent device easily connect different manufacturers. In the free port mode, can be continuously sent or received less than 255 bytes of data, in the large data communication is very convenient.

2。 3, MAX485E MAX485E chip is RS - chip 485 standard dedicated communication interface chip, as shown in figure 1, for the data output RO the feet, it receives RS - 485 the VAB differential mode signal, and converted to the TTL level by RO output, RE feet for RO make can end, low electric gate RO at ordinary times, output effectively. DI feet for data input, it converts the TTL level data for the VAB differential mode signal, and by A, B two feet away, DE is DI can end, high level gating DI, enter A valid. Therefore, both RS - A, B two feet 485 signal input, is also the output of the signal, the key is by enabling end RE, DE level to decide.

2。 4, the hardware connection diagram S7 - The RS - 200 PLC 485 interface standard, receives the differential mode signal, and the output of the PIC16F877 single-chip microcomputer as the TTL level, so the two must transform during the communication, the system adopts MAX485E chip as the conversion chip, the hardware connection as shown in figure 1. Controlled by PIC16F877 RC4 select data input or output.

figure 1 hardware connection diagram

3, communication protocol by PIC16F877 single-chip microcomputer in this project is to send data, PLC controller simply receiving data, so using simplex serial communication. PLC adopts the model of free port agreement, the agreement by the statement table programming implementation; MCU USES USART module of the asynchronous delivery mode, the agreement in assembly language programming. Controlled by PIC16F877 send buffer structure, one can only send two consecutive bytes of data, so the PLC controller using characters receive complete disruption is more convenient. Interface standards using RS - consistent with PLC side D 9, 485, joint use needle shaped connectors, using a transmission line is shielded twisted-pair cable, single chip microcomputer side sends data need to the conversion before sending.

character information format as follows: 1 a start bit, 8 data bits, no parity, 1 stop bit.

asynchronous communication character information format is shown in figure 2.


character information format data bits sent order for low before, and high in the back.

technology zone CPU cache and the second level cache depth analysis eMMC mass burn trouble, do you really know? Isolated flyback and BUCK application design schottky diode in the selection and application guide design how to use Altium Designer makeup?
Coolmay needs to be able to reach social users in a way that complements what the brand is doing if they want to succeed at social commerce.
With continuous operational improvements, expanding capacity and a strong competitive position for serving strategic domestic markets, Shenzhen Coolmay Technology Co., Ltd. are positioned for long-term growth that will benefit our customers and investors.
In order to obtain the most suitable for your programmable control systems, you need to contact qualified suppliers which can produce super quality to your specifications and offer a friendly price.
Custom message
Chat Online 编辑模式下无法使用
Chat Online inputting...