Information Technology Reference
In-Depth Information
Address Function Start address (hi) Start address (lo) No. (hi) No. (low) LRC
:12 01 02 10 00 01 DA
Then on an error, the response would send back the function code of 81 (which sets the most
significant bit of the function code (that is, 1000 0001). If the slave were busy then the ex-
ception code would be 06. Thus the code sent back will be:
Address Function Exception code LRC
12 81 06 67
18.1.6 Data field
The data fields contains even multiples of hexadecimal digits (in ASCII mode) or an even
number of binary values (in RTU mode). The format of the field depends on the function
code, and contains information, such as register addresses, the number of values required and
the number of bytes in the data field.
For example if the function code is 01 (read code status), then the format of the frame
send from the master to the slave is:
Slave address ( xx ).
Function (01) - read coil status.
Starting address high ( xx ) - most-significant byte of the starting register address.
Starting address low ( xx ) - least-significant byte of the starting register address.
Number of Points high ( xx ) - most-significant byte of the number of points to be sent.
Number of Points low ( xx ) - least-significant byte of the number of points to be sent.
Error check ( xx ).
If there are no errors, then the response is:
Slave address ( xx ).
Function (01) - read coil status.
Byte count.
Data (Coils 8 to 1) - data for the first eight coils, where a 1 value in a coil bit position
represents ON, whereas a 0 represent OFF.
Data (Coil 16 to 9) -data for the next eight coils.
etc.
Error check ( xx ).
Some data fields are empty, such as the communication event log function (12, or 0Bh).
18.1.7 Error checking field
The error checking method depends on the type of transmission, these are:
ASCII - in this mode the error checking field contains two characters, which performs a
longitudinal redundancy check (LRC) for all characters, excluding the start and end ter-
minating characters (:, CR and LF).
RTU - in this mode, the error-checking field contains a 16-bit value which performs a
cyclical redundancy check (CRC). This field is added to the end of the message; the
low-order byte of the field is appended first, followed by the high-order byte.
Search WWH ::




Custom Search