HART Introduction
HART (Highway Addressable Remote Transducer), is one of the industrial field bus standards.
Three main layers
Physical layer: analog signal transmission on 4~20 mA carrier;
Data link layer: ensure reliable data transmission on the physical layer;
Application layer: correct implementation of information interactive ;
Technical characteristics
Both two types of communication channels:
- 4~ 20mA analog communication
- modulated data communication;
Standard operation process:
- loop test;
- 4~ 20mA analog setting;
- Sensors adaption;
Two communication topologies :
-
Point-to-pointing (classic)
In the HART network, two Master is allowed, one for system control, another for handling device.
-
Point to multi-point
Two communication interactive modes :
2.1. Request mode (Master-slave mode):
2.1.1 The slave response when the request is received ;
2.1.2 Other Masters will be allowed to send requests when time is idle;
2.1.3 2~ 3 times interaction each second;
2.2. Burst mode (slave pub process data):
2.2.1 slave selectable mode;
2.2.2 slave periodic sending measurement;
2.2.3 Other Masters will be allowed to send requests when time is idle;
2.2.4 3~ 4 times interaction each second;
FSK (frequency shift keying)
HART command types and functions
See the table below:
HART message structure
Usually, long-structure and short-structure are used in a different version of HART, for example, HART 5.0 and earlier versions would work with short-structure. Due to the non-uniqueness of the message to HART, it should be considered when designed, but no longer than 25 bytes, generally includes:
-
Preamble // includes 5 to 20 0xFF, it could be seen as a kind of synchronous signal, check master and slave machine at the beginning of transmission;
-
Delimiter // start byte includes information about ‘whether long or short structure’, ‘message source’, ‘what type of message’;
When master to slave is short-structure, this byte is 02;
When master to slave is long-structure, this byte is 82;
When slave to master is short-structure, this byte is 06;
When slave to master is long-structure, this byte is 86;
Burst mode: short-structure is 01, long-structure is 81; -
Address // address byte includes slave and master address;
-
Command //command byte,0x00 to 0xFD 253 in total;
-
Bcnt // total data length, it could help to find check-byte and know of the message ends;
-
Status // status byte, also called ’response code’;
-
Data // data byte
-
Check // parity check byte;
There are two frame formats of HART communication from Master to slave and Slave to master. When considering how to build a data structure of a message to satisfy communication with strong flexibility, the content difference between commands should be clearly understood. -
Master-to-slave frame
/preambles +delimeter+ expansion+ longAddr+ byteCnt+ data
20 + 1 + 3 + 5 +1 + 255 =285/
[ Preamble ]: length depends ( max 20 bytes)
[ Delimiter ]: fixed-length ( 1 byte)
[ Address ]: long address(5 bytes) or short address(1 byte) types
[ Command ]: fixed-length ( 1 byte)
[ Byte Count ]: fixed-length ( 1 byte)
[ Data ]: length depends ( max 255 bytes)
[ Check Byte ]: fixed-length ( 1 byte)
Also, the expansion byte should be considered in this section.
According to specific commands, the length of the frame will be different, for example, in the command 0 in the universal command type, the requested data is 0, and using the short address type, it makes the whole length of the frame much shorter than most commands, as a developer, that’s what we concerned when an attempt to build once communication at the beginning. -
Slave to the master frame
Similar to the previous structure, more details will be analysed in serials commands, especially data content.
Program Concerns
Some points before coding through my experience:
- How to understand analog and digital signals in HART transmission;
- The configuration of analogue signal output, such as slew rate.
- The frame of message in communication, includes how to build an unfixed message, and response time setting(timer).
- What command type will be used, clearly understand their difference in each frame section.
- Basic communication builds, and debugging.
- Build a structure to analyze response data, and translate it to USER data from BYTE data, such as read loop current value.
写完了终于可以吃饭去了