laitimes

Hongrun OHR series intelligent display control instrument RS-485 communication application

author:Fujian Hongrun

1. Summary

OHR series intelligent display control instrument is a new generation of intelligent display control instrument designed and produced after years of development and manufacturing experience, integrating many new functions. For the site temperature, pressure, liquid level, speed, flow and other signals to collect, display, control, remote transmission, communication, printing and other processing, constitute a digital acquisition system and control system, widely used in electric power, petrochemical, metallurgy, light industry, pharmaceutical, aviation and many other fields. The EMC design of the product conforms to the relevant provisions of GB/T17626.2-11, and the product has obtained CE certification.

Second, the market background of the product

In the field of automation control, with the development of distributed control systems, serial communication is often required to achieve the purpose of remote information exchange in industrial distributed control systems. Currently, interface standards for serial communication include: RS-232, RS-422, RS-423, and RS-485. RS-232 is the earliest serial interface standard and is widely used in short-spaced, low-baud rate serial communications. RS-422 and RS-485, which were developed later, are the electrical standards for balanced transmission, and have greatly improved the electrical indicators compared to the unbalanced transmission mode of RS-232. The electrical standard for RS-485 serial interfaces is actually a variant of RS-422, which is a protocol standard for the physical layer of the Layer 7 OSI (Open System Interconnection) model. Due to its excellent performance, simple structure and easy networking, the RS-485 bus standard has been more and more widely used. The following is about the application of Hongrun OHR series intelligent display control instrument in RS-485 communication.

Third, the technical principle of the product

1. System technical scheme

  In industrial situations, it is often necessary to use some instruments to control such as temperature, liquid level, flow rate, etc. In some cases, a single controller is required to flexibly control multiple instruments for design control purposes.

In this paper, the standard MODBUS RTU communication protocol and RS-485 communication instructions are used to easily realize the serial communication with multiple Hongrun OHR series instruments, and the flexible control of multiple instruments with a single controller is successfully realized. The programmable controller allows up to 100 Hongrun instruments to be connected on an RS-485 communication interface, and when the instruments are more than 60, an RS-485 repeater needs to be added, and the communication distance of the RS-485 communication port is more than 1KM.

2. Hardware design of RS-485 bus

Considering that the number of network nodes in this control system is large, the whole network has more than 100 nodes, in order to ensure the reliability and communication efficiency of communication, each instrument is distributed on two buses according to the different functions, data flow and real-time requirements realized by the instrument in the system, and the rs-485 chip driving capacity in the selected device reaches 255 points, the communication rate is 9.6Kbps, and the farthest node from the master station is not more than 50m.

3. Network protocol

In order to enable specific commands and data to be transmitted correctly on the network, a certain network protocol must be provided at the data link layer to ensure that the bitstream at the physical layer is detected and corrected when there is an error, and the functions of data frame and command frame must be realized at the same time. However, in order to ensure the quality of data transmission, while checking each byte, the feature word and check word should be minimized, and the commonly used packet format is composed of boot code, length code, address code, command code, data, check code, tail code, each packet length is up to 20~30 bytes, which is a bit complicated in the RS-485 system. Because the modbus protocol is a public communication protocol, and is supported by many industrial control product manufacturers, the protocol has been widely used in the international standards of equipment and systems in water conservancy, hydrology, electric power and other industries, therefore, the system uses the modbus protocol as the network protocol of this control system.

  In this control, because the communication data volume of PLC and frequency converter is small and the real-time performance requirement is not high, the modbus ASCII mode is adopted, and the data communication volume of the single-chip microcomputer is large and the real-time performance is high, so the modbus RTU mode is adopted.

Fourth, the application of the product

Considering the real-time, effectiveness and correctness of 100 instruments on the RS485 bus, the communication network of 100 Hongrun OHR series intelligent control instruments is divided into two buses, which are respectively defined as A1, B1 and A2 and B2 by the serial port expansion port of PLC;

Hongrun OHR series intelligent display control instrument RS-485 communication application
Hongrun OHR series intelligent display control instrument RS-485 communication application

1. Hongrun OHR series intelligent display control instrument communication parameter configuration

(1) The communication mode is RS-485, (1 start bit, 1 or 2 stop bits, 8 bits of data, no parity)

(2) The baud rate of communication transmission data (1.2K 2.4K 4.8K 9.6K 19.2K ) can be set in the instrument three baud

(3) The communication protocol is the standard Modbus RTU mode

Here we highlight the RS-485 interface between the programmable controller and the Hongrun OHR instrument. In the industrial field, RS-485 communication is a communication mode that is more widely used, the programmable controller in the figure is connected with a plurality of OHR instruments through the RS-485 communication interface, up to 100 units, each instrument is given their respective address code, for identification, (the address code can be set in the instrument three Addr), the sub-unit and the main unit adopt the address polling mode. In this way, the RS-485 communication port of the programmable controller can control and operate all the instruments hanging below through the RS485 bus.

2. Communication data flow analysis of Hongrun OHR series intelligent digital display controller

This communication protocol adopts the standard ModBus protocol and adopts RTU (hexadecimal number) transmission mode. The ModBus protocol is a master---slave protocol. Only one device can transmit on the line at any one time. The exchange of information is managed by the master and can only be initiated by the master. The master will take turns to query the slaves. The slave can reply to the message only if the slave address matches the polling address. Direct communication between slaves is not possible. The protocol does not contain any message header and message end character, and the start and end of a message are identified by the interval time, when the interval is longer than or equal to 3.5 characters, it is considered to be the end of the detected message. If there is no slave in the network that is consistent with the query address or the CRC verification error occurs when the slave receives it, the master station will not receive the return frame, and the master station will judge whether it has timed out according to the timeout setting, and if it times out, it will resend or pop up an abnormal error window.

The definition of the agreement is as follows:

Slave address Feature code Data area CRC16

Slave address: The address must be between 1---247.

Within the same master network, each slave address must be unique.

0 is the broadcast address, and the slave receives the message and processes it accordingly, but cannot reply to the message.

Function code: Contains read and write registers.

Data: Transmitted in binary code.

CRC16: cyclic redundancy check, which checks the slave address to the last byte of the data area, and calculates the polynomial code as A001 (hex).

(1) Communication port setting

Communication mode: Asynchronous serial communication interface, such as RS-485, RS-232, etc

Baud rate 2400~9600bps (can be freely changed by setting the secondary parameters of the instrument, setting the secondary parameters of the instrument BT, the default is 4800)

(2) Byte data format HEX

One start bit, eight data bits, one stop bit, no check

1 * * * * * * * * 1

Start bits: Data bits (low to high) Stop bits

(3) Message format (read and write functions are defined from the perspective of the master)

Read register zhen

Slave address Feature code The address of the first register Number of registers N CRC16
1 byte 1 byte 2 bytes 2 bytes 2 bytes
0---247 03H AddrH, AddrL NH (1---24) CrcL, CrcH

Read registers return to the zhen

Slave address Feature code Number of bytes Register data CRC16
1 byte 1 byte 1 byte N*2 bytes 2 bytes
1---247 03H N*2 DataH, DataL CrcL, CrcH

Write register zhen

Slave address Feature code The address of the first register Number of registers N Number of bytes Register data CRC16
1 byte 1 byte 2 bytes 2 bytes 1 byte N*2 bytes 2 bytes
0---247 10H AddrH, AddrL NH, NL 1---24 N*2 DataH, DataL CrcL, CrcH

The write register returns the zhen

Slave address Feature code The address of the first register Number of registers N CRC16
1 byte 1 byte 2 bytes 2 bytes 2 bytes
1---247 10H AddrH, AddrL NH, NL 1---24 CrcL, CrcH

Error returned zhen

Slave address Feature code Error codes CRC16
1 byte 1 byte 1 byte 2 bytes
1---247 Query function code +80H See Table 2 CrcL, CrcH

Feature Code Table: 1

Feature code ModBus Name Feature name broadcast The maximum value of N at a time
03H Read Holding Registers Read N register values No 24
10H Write Multiple Registers Write N register values No 24

Error Code Table: 2

Error codes illustrate
1 The register length is out of limit
2 The register address is out of limit
3 Slave password protection
4 Reading or writing is not allowed, for example, some registers are read-only, so you can't write commands

3. Product pictures

Hongrun OHR series intelligent display control instrument RS-485 communication application

V. Conclusions

This paper uses the standard MODBUS protocol and Hongrun OHR series intelligent display control instrument for RS-485 communication, which realizes the task of controlling multiple OHR instruments by a single controller, and can detect the operation status of each instrument in real time, the whole system control is flexible and convenient, the scheme structure is simple, the development cost is low, the cycle is short, and it can work stably even in harsh industrial environments.

Hongrun OHR series intelligent display control instrument RS-485 communication application

Read on