AnyBus® Communicator Protocol Appendix - Modbus
DOC. ABC-APPENDIX-MB Rev.0.91
2001-08-01
HMS INDUSTRIAL NETWORKS AB
5
1.2 AB-C as Modbus master
When the AB-C acts as master on the Modbus network it uses a scan-list for communication with the different slaves
on the network as described in the "Sub-network, Master" section. The scan-list is defined using AbcCon.When Mod-
bus protocol is selected you add pre-defined modbus commands to the scan-list simply by selecting them from a list.
The next chapter describes all the supported Modbus commands and what you need to think about when using them
in the AB-C.
What makes the AB-C Modbus specific is the way transactions are used in Modbus commands and what the transac-
tions consist of. One important issue in the AB-C is that the data must be of a pre-defined length. The example below
shows how this works.
Basically, if we exclude the start character and stop character in the Modbus frame, each Modbus frame consists of
two one-byte objects, one data object, maybe some more one- or two-byte objects and one error-check object. Lets
take an example using Modbus RTU. Example. Read Holding Register (0x03) to node 0x05.
This command is built up like this:
Query:
What you as a user must do here is to enter "Starting address" and "No. of points". These two parameters are repre-
sented as two-byte objects that you enter values into using AbcCon. This command will ask the slave for the same
registers every time the command is sent and unless something goes wrong, the slave will answer with the same
amount of data every time.
Response:
In the response the data section in the Modbus frame needs to be filled in. Here the data section is represented by a
one-byte object (byte count) and a data object (data). To match the query you need to add a value into the one-byte
object that is two times the No. of points value you entered in the query. Furthermore, the data object needs a starting
address and a length where the length should match the one-byte object (byte count).
As you can see the requested data is always of the same length and therefore the data object in the response is also
always of the same length. Should less bytes than specified arrive then the response is considered to have an error and
a re-transmission of the query will occur if this command is configured for re-transmission. The same handling is
done if more data than expected arrives.
Modbus frame
Address
Function
Data
Error check
Frame contents
0x05
0x03
“Starting Address”
“No. of points”
CRC
AB-C frame
“One byte
object”
“One byte
object”
Two byte object
Two byte object
“Error check
object”
Table 1: Query
Modbus frame
Address
Function
Data
Error check
Frame contents
0x05
0x03
“Byte count”
“Data”
CRC
AB-C frame
“One byte
object”
“One byte
object”
One byte object
“Data Object”
“Error check
object”
Table 2: Response