![Campbell CR6 Series Скачать руководство пользователя страница 114](http://html1.mh-extra.com/html/campbell/cr6-series/cr6-series_product-manual_3769841114.webp)
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 data loggers can be programmed to be a Modbus master or Modbus slave -
or even both at the same time! This proves particularly helpful when your data logger 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 data logger 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 data logger.
CRBasic Modbus instructions include:
l
ModbusMaster()
l
ModbusSlave()
l
MoveBytes()
See the CRBasic Editor help for detailed instruction information and program examples:
https://help.campbellsci.com/crbasic/cr6/.
7.2.6.1 Endianness
Endianness refers to the sequential order in which bytes are arranged into larger numerical values
when stored in memory. Words may be represented in big-endian or little-endian format,
7. Communications protocols
96