January 09, 2025

Realization of HART Communication Protocol in Remote Communication of Field Instruments

Realization of HART Communication Protocol in Remote Communication of Field Instruments

1 Introduction to HART protocol

HART (Highway Addressable Remote Transducer), an open communication protocol for addressable remote sensor high-speed channels, is a communication protocol used by the American Rosemen Company in 1985 for field smart instruments and control room equipment.

HART devices provide communication with relatively low bandwidth and moderate response time. After more than 10 years of development, HART technology has become very mature abroad and has become the industry standard for global smart meters.

HART protocol adopts FSK frequency shift keying signal based on Bell202 standard, and superimposes audio digital signal with amplitude of 0.5mA on low frequency 4-20mA analog signal for two-way digital communication, and the data transmission rate is 1.2Mbps. Since the average value of the FSK signal is 0, it does not affect the size of the analog signal transmitted to the control system, ensuring compatibility with the existing analog system.

In HART protocol communication, the main variables and control information are transferred from 4 to 20 mA. If necessary, additional measurement, process parameters, device configuration, calibration, and diagnostic information are accessed through the HART protocol.

HART communication uses half-duplex communication.

The HART protocol refers to ISO / OSI (Open System Interconnection Model) and uses its simplified three-layer model structure, namely the first physical layer, the second data link layer and the seventh application layer.

The first layer: the physical layer. The signal transmission method and transmission medium are specified. In order to achieve analog communication and digital communication at the same time without interfering with each other, the HART protocol uses frequency shift keying technology FSK, that is, a frequency signal is superimposed on the 4-20mA analog signal. The signal adopts the Be11202 international standard, the transmission baud rate of the digital signal is set to 1200bps, 1200Hz represents logic "0", 2200Hz represents logic "1", and the signal amplitude is 0.5A, as shown in Figure 1.

Physical layer

The choice of communication medium depends on the length of the transmission distance. When using twisted-pair coaxial cable as the transmission medium, the maximum transmission distance can reach 1500m. The total impedance of the line should be between 230 and 1100Ω.

The second layer: data link layer. The format of the HART frame is specified to realize the functions of establishing, maintaining and terminating link communication. According to the redundant error detection code information, the HART protocol uses an automatic repeat request transmission mechanism to eliminate data communication errors caused by line noise or other interference, and realize error-free transmission of communication data.

For field instruments to execute HART instructions, the operands must conform to the specified size. Each independent character includes a start bit, 8 data bits, a parity bit and a stop bit. Because the existence and length of data are not constant, the length of HART data is also different. The longest HART data contains 25 bytes.

The seventh layer: application layer. It is a HART command set, used to implement HART commands. Commands are divided into three categories, namely general commands, ordinary commands and special commands.

2 Field instrument HART protocol remote communication hardware design

The HART protocol part of a field instrument mainly completes the conversion of digital signals to analog current signals, and achieves access to the main variables and measurements, process parameters, device configuration, calibration, and diagnostic information. Figure 2 is a block diagram of the HART protocol communication module structure design.

HART protocol communication module structure design block diagram

The HART communication part is mainly realized by D / A conversion and Bell202 MODEM and its auxiliary circuits. Among them, the role of D / A conversion is to directly convert digital signals into 4 ~ 20mA current output to output the main variables. The function of Bell202 MODEM and its ancillary circuits is to band-pass filter and amplify the signal superimposed on the 4-20mA loop. If the HART communication unit detects the FSK frequency shift keying signal, the Bell1200 MODEM demodulates the 1200Hz signal into "1", the 2200Hz signal is demodulated to "0" digital signal, and it is sent to the MCU through serial communication. The MCU receives the command frame and performs corresponding data processing. Then, the MCU generates a response frame to be sent back. The digital signal of the response frame is modulated by the MODEM into the corresponding FSK frequency shift keying signals of 1200Hz and 2200Hz. After the waveform is shaped, it is sent out on the loop by the AD421.

The D / A converter uses AD421, which is a single-chip high-performance digital-to-analog converter launched by American Analog Devices. It is powered by a loop. 16-bit digital signals are input in a serial manner, which can directly convert digital signals into 4 ~ 20mA current output. It provides a high-precision, fully integrated, low-power solution, using 16-pin DIP, TSSOP, SOIC package, can achieve low-cost remote intelligent industrial control. AD421 includes serial input 16-bit D / A (digital / current) conversion. In addition to its own power supply, it also provides an optional (5V, 3.3 V or 3 V) regulated output for other parts of the transmitter.

HART MODEM uses Smar's HT2012, which is a half-duplex modem that meets the Bell202 standard, and implements the encoding or decoding of the digital communication specified by the HART protocol. The chip is specially designed for HART instruments, and integrates the modulator, demodulator, clock and timing circuit and detection control circuit that meet the BELL202 standard. High cost performance, 16-pin DIP and 28-pin PLCC package, working current 80μA when + 5V power supply. HT2012 exchanges digital signals with a microcontroller, and uses AD421 as an analog signal interface. On the one hand, it performs serial communication with the asynchronous serial communication port of the MCU. On the one hand, it modulates the input non-returned digital signal into FSK signal, and then superimposes it on the 4-20mA loop output by AD421, or the loop signal After band-pass filtering, amplification and shaping, the FSK signal is taken out and demodulated into a digital signal, thereby realizing HART communication.

For the input clock required by HART MODEM, a crystal of 7.3728MHz is used to divide the frequency by two times by two counters 74LS161 to obtain a clock divided by 16.

Due to the requirements of HART digital communication, there is a 0.5mA sine wave current signal superimposed on the 4mA current, so the entire hardware circuit must ensure that it can still work normally below 3.5mA, so it is very important to realize the low power design of the system.

Figures 3 and 4 are the peripheral circuit diagrams of the AD421 and HT2012, respectively.

Adopt the peripheral circuit diagram of AD421 and HT2012

Adopt the peripheral circuit diagram of AD421 and HT2012

3 Communication software design

The HART communication program is also the software implementation of the HART protocol data link layer and application layer, which is the key to the design of the entire field instrument software.

During the HART communication process, the host (host computer) sends a command frame. After the field instrument receives the command frame through the serial port interrupt, the MCU performs the corresponding data processing to generate a response frame. The MCU triggers the sending interrupt to send the response frame. Thus completing a command exchange.

First of all, after power on or watchdog reset, the main program should initialize the communication part, mainly including baud rate setting, serial port working mode setting, clearing the communication buffer, open interrupt, etc.

After the initialization is completed, the communication part is always in the state of receiving. Once the host computer sends a command, the carrier detection port OCD of the HT2012 becomes low level, triggers an interrupt, and starts receiving. The program enters the receiving part. Then complete the interpretation of the host command and perform the corresponding operation according to the command, and finally generate a response frame in a certain format and send it to the communication buffer, start sending, and close the SCI after completion.

Fig. 5 is a flowchart of a procedure for serially receiving a request frame and replying a response frame.

Serial request frame

After sending the response frame, enter the wait state again, waiting for the next host command.

4 Conclusion

Practice has proved that the above method has the characteristics of simple structure and reliable work, fully complies with the HART protocol, and has good versatility.

Due to its undoubted advantages, HART has become the most widely used field communication protocol in the world and has become a practical standard in the industry. Therefore, for a long period in the future, HART protocol products still have a very broad market in China.

Connector 2.5mm Pitch

Connector 2.5Mm Pitch,S11 Connectors,Welding Bar Connectors,Pressure Weld Bar Connector

YUEQING WEIMAI ELECTRONICS CO.,LTD , https://www.weimaicarconn.com