most appropriate action - either to repeat the original message, to try and diagnose
what has happened to the slave, to set alarms or to take whatever action is most
appropriate.
The data field
The data field transmits a number of hexadecimal values, each in the range 00 to FF.
In ASCII transmission mode this is made up of a pair of characters, in RTU it is a
single character.
A significant aspect of the communication between the master and it's slaves, that is
not defined by Modbus, is the encoding of numerical data. Modbus allows the
manufacturers of devices to determine which data encoding techniques are available
to users of the device. The encoding of data is discussed on page 13.
The data field is used to provide the slave with any additional information needed to
perform the function requested in the query. This would typically be a register address,
a register range or a value. With some functions, the data field is not required and will
not be included in the query.
If no errors occur, the data field of the response is used by the slave to pass data back
to the master.
If an error occurs, the data field is used to pass more information to the master relating
to the nature of the fault detected.
Byte count data
The responses to a number of queries require the slave to inform the master of the
number of data bytes that are being returned in the response, and this requires a
special implementation within the data field.
A typical example of this would be when the master has requested the slave to
communicate the status of a range of registers. The slave responds by repeating the
function code and it's own address, followed by the data field. The first byte of the data
field identifies the number of bytes that are being returned that contain the register
status information.
As was mentioned earlier, ASCII mode requires two 8-bit bytes to communicate a
single register content, compared to RTU which only requires a single 8-bit byte. This
difference is ignored when the byte count field is calculated, and the number of bytes
indicated is identical to the number of bytes communicated in RTU mode, but is half
the actual number of bytes communicated in ASCII mode.
The error check field
The error checking technique employed on the Modbus network depends on the
transmission mode selected. With ASCII the technique used is based on an LRC
(Longitudinal Redundancy Check) and with RTU a CRC (Cyclical Redundancy Check).
In both cases, the characters transmitted in the error check field are calculated by the
transmitting device and included in the resulting transmission. The receiving device
calculates what the error check field should contain, on receipt of the message, and
compares it with the error check field in the received message. If these two values do
not match exactly, then the receiving device knows that it has not received the
message correctly, and disregards it.
In both modes, parity checking can be optionally selected.
A fuller explanation of the error checking techniques used by Modbus is given in
Appendix A.
Data Encoding and Scaling
As has been mentioned earlier, an important area of the communication along the
network, that is not defined by the Modbus protocol, is the encoding of numerical data.
A related problem is the adoption of a scaling system for the data once it has been
encoded. (Note: this is an area which requires careful consideration by users of the
MTL838B-MBF.)
There is no problem here for manufacturers who are supplying complete systems,
based on the Modbus network, as they can select a data encoding and scaling system
appropriate to their needs. However, for manufacturers who are supplying products for
general use, there is no possibility that they will be able to determine which data
encoding system will be used by their customers, and they must allow the data
encoding technique to be user selectable.
Three data encoding techniques are the most popular - IEEE, 16-bit unsigned and 16
bit offset.
A further area of difficulty associated with the encoding of data is the way in which the
data is scaled - to provide a resolution of the measured value appropriate to the
wechat/whatsapp:
Email: kongjiangauto@163.com
Copyright © 2009 - 2024 Cld , All Rights Reserved K-JIANG All rights reserved