
7.2.5 Modbus master-slave protocol
Modbus is a master-slave protocol. The device requesting the information is called the Modbus
master, and the devices supplying information are Modbus slaves. In a standard Modbus
network, there is one master and up to 247 slaves. A master does not have a Modbus address.
However, each Modbus slave on a shared network has a unique address from 1 to 247.
A single Modbus master device initiates commands (requests for information), sending them to
one or more Modbus slave devices on the same network. Only the Modbus master can initiate
communications. Modbus slaves, in turn, remain silent, communicating only when responding to
requests from the Modbus master.
Every message from the master will begin with the slave address, followed by the function code,
function parameters, and a checksum. The slave will respond with a message beginning with its
address, followed by the function code, data, and a checksum. The amount of data in the packet
will vary, depending on the command sent to the slave. Slave devices only process one command
at a time. So, the master needs to wait for a response, or timeout before sending the next
command.
A broadcast address is specified to allow simultaneous communications with all slaves. Because
response time of slave devices is not specified by the standard, and device manufacturers also
rarely specify a maximum response time, broadcast features are rarely used. When implementing
a system, timeouts in the master will need to be adjusted to account for the observed response
time of the slaves.
Campbell Scientific dataloggers can be programmed to be a Modbus master or Modbus slave -
or even both at the same time! This proves particularly helpful when your datalogger is a part of
two wider area networks. In one it uses Modbus to query data (as a master) from localized
sensors or other data sources, and then in the other, it serves that data up (as a slave) to another
Modbus master.
7.2.6 About Modbus programming
Modbus capability of the datalogger must be enabled through configuration or programming.
See the CRBasic Editor help for detailed information on program structure, syntax, and each
instruction available to the datalogger.
CRBasic Modbus instructions include:
l
ModbusMaster()
l
ModbusSlave()
l
MoveBytes()
7. Communications Protocols
86
Summary of Contents for CR1000X
Page 1: ...Revision 02 21 2019 Copyright 2000 2019 Campbell Scientific ...
Page 2: ......
Page 4: ......
Page 6: ......
Page 8: ......
Page 16: ...Appendix A Glossary 176 Appendix B Index 214 Table of Contents viii ...
Page 192: ......