HART is also a communication protocol, but most of them are used in the industry. At present, its application prospects are very impressive. Many products will involve the use of this Protocol. Next we will introduce the hardware design used by an instrument of this Protocol. First, let's make a simple analysis of this Protocol.
I. HART Protocol
HART (Highway Addressable Remote Transducer), an open communication protocol that can address Remote sensor express connect, it is a communication protocol between on-site intelligent instruments and control room equipment launched by Rosemen in 1985 。
The HART device provides communications with relatively low bandwidth and moderate response time. After more than 10 years of development, the HART technology has become very mature abroad, and has become the industrial standard of global intelligent instruments. The HART protocol adopts the base of the Bell202 standard, which is 4mA ~ 20mA two-way digital communication is performed on an audio digital signal with a superposition amplitude of 5mA. The data transmission rate is Mbps, the size of analog signals transmitted to the control system is not affected, ensuring compatibility with the existing simulation system 。
In the HART Protocol Communication, the main variables and control information are from 4mA ~ 20mA transmission, where necessary, other measurement, process parameters, device configuration, calibration, and diagnostic information are accessed through the HART protocol 。
HART communication adopts a half-duplex communication mode. The HART protocol adopts a simplified three-layer model structure, that is, the first layer of physical layer, referring to ISO/OSI (Open System Interconnection Model, layer 2 data link layer and Layer 7 Application layer 。
The first layer: physical layer. It specifies the signal transmission method and transmission medium. In order to achieve both analog and digital communication without mutual interference, the HART protocol uses the Frequency Shift Keying Technology, that is, from 4mA ~ 20mA a frequency signal is added to the analog signal. The frequency signal adopts the Be11202 international standard. The Transmission baud rate of the digital signal is set to 1200bps. The 1200Hz indicates the logic "0", and the 2200Hz indicates the logic "1 ", signal Amplitude 0.5A 。
The choice of communication medium depends on the length of transmission distance. Generally, the maximum transmission distance can reach 230 m when the twisted pair coaxial cable is used as the transmission medium ~ 1100 Ω 。
Layer 2: data link layer. It specifies the HART frame format to establish, maintain, and terminate Link communication. The HART protocol uses an automatic repeated request sending mechanism based on Redundant Error code information, eliminate data communication errors caused by line noise or other interference, so that communication data can be transmitted without errors 。
The field meter must execute the HART command, the operands must conform to the specified size. Each independent character includes one start bit, eight data bits, one parity bits, and one stop bits, therefore, the length of the HART data is different. The longest HART data contains 25 bytes 。
Layer 3: Application layer. It is a HART command set used to implement HART commands. commands are divided into three types: General commands, General commands, and special commands 。
Ii. Hardware Design for remote communication of the HART protocol for on-site Instrumentation
The HART protocol of a field meter converts digital signals to analog current signals, and accesses the main variables and measurement, process parameters, equipment configuration, calibration and diagnosis information 。
The HART communication part is mainly implemented by the D/A conversion and the Bell202 MODEM and their ancillary circuits. The function of the D/A conversion is to directly convert the digital signal to 4mA ~ 20mA current output to output the main variable. The role of the Bell202 MODEM and its ancillary circuit is to overlay the current in 4mA ~ After the signal on the 20mA loop is amplified by band-pass filtering, if the HART communication unit detects the Frequency Shift Keying Signal, The Bell202 MODEM decrypts the frequency Hz signal to "1 ", the 2200Hz digital signal is demodulated to "0". The MCU communicates with the MCU through the serial port to receive the command frame and process the corresponding data. Then, the MCU generates the response frame to be sent back, the digital signal of the response frame is modulated by the MODEM into the corresponding frequency Hz and 2200Hz Frequency Shift Keying signals. After waveform shaping, the digital signal is superimposed 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 the American ADI company. It is powered by A loop, and 16-bit digital signals are input in serial mode, the digital signal can be directly converted to 4mA ~ 20mA current output. It provides high-precision, fully integrated, and low-power solutions, using 16-pin DIP, TSSOP, SOIC encapsulation, it can realize low-cost Remote Intelligent Industrial Control. AD421 includes serial input 16-bit D/A (digital/current) conversion, in addition to its own electricity, it also provides optional (5 V, 3.3 V or 3 V) Voltage Regulator output for other parts of the transmitter 。
Hart modem adopts Smar's HT2012, which is a half-duplex MODEM compliant with the Bell202 standard and implements the coding or decoding of digital communication as stipulated in the HART protocol. This chip is designed for HART instruments, the chip is integrated with the following components: the tuner, modem, clock, timing circuit, and detection and control circuit complying with the BELL202 standard. The 16-foot DIP and 28-foot PLCC encapsulation are cost-effective, when the power supply is 5 V, the operating current is 80 μA. HT2012 exchange digital signals with the microcontroller and uses the analog signal interface with AD421. On the one hand, HT2012 performs serial communication with the asynchronous serial communication port of MCU, on the one hand, the input non-return digital signal is modulated into a PSK signal, and then superimposed on the 4mA ~ through the AD421 ~ 20mA of the return signal, or filter the loop signal through the band-pass, zoom in and shaping the system, and then retrieve the '2's signal and demodulated it into a digital signal to implement HART communication 。
For the input clock required by the hart modem, use the 7.3728MHz crystal oscillator to divide the clock by 4 times through two counters 74LS161 。
Due to the requirements of HART digital communication, a 5mA sine wave current signal is superimposed on 4mA current. Therefore, the entire hardware circuit must work properly at 5mA or less, therefore, it is very important to design low power consumption of the system 。
3. Communication Software Design
The HART communication program is the software implementation of the data link layer and application layer of the HART protocol. It is the key to the software design of the entire field instrument 。
During HART communication, the host (host computer) sends a command frame. After the on-site instrument receives the command frame through a serial port interruption, the MCU processes the data and generates a response frame, the MCU triggers sending interruption and sends a response frame to complete a command exchange 。
First, after power-on or the watchdog is reset, the main program initializes the communication part, including the baud rate setting, serial port working mode setting, clear the communication buffer, and enable the interrupt 。
After the initialization is complete, the communication part is always in the ready-to-receive State. Once a command is sent from the host computer, the OCD of the HT2012 carrier detection port changes to a low level, which triggers interruption and starts receiving, the program then enters the receiving part. Then, the host command is interpreted and corresponding operations are performed according to the Command. Finally, the response frame is generated in a certain format and sent to the communication buffer zone to start sending, close SCI after completion 。
After sending the response frame, wait for the next host command again 。
Iv. 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 。
Thanks to the many unquestionable advantages of HART, it has become the world's most widely used field communication protocol and has become a practical industrial standard. Therefore, for a long time in the future, HART protocol products still have a very broad market in China 。