7.2.7 Modbus information storage
With the Modbus protocol, most of the data values you want to transmit or receive are stored in
registers. Information is stored in the slave device in four different entities. Two store on/off
discrete values (coils) and two store numerical values (registers). The four entities include:
l
Coils – 1-bit registers, used to control discrete outputs (including Boolean values),
read/write.
l
Discrete Input – 1-bit registers, used as inputs, read only.
l
Input Registers – 16-bit registers, used as inputs, read only.
l
Holding Registers – 16-bit registers; used for inputs, output, configuration data, or any
requirement for “holding” data; read/write.
7.2.7.1 Registers
In a 16-bit memory location, a 4-byte value takes up two registers. The Modbus protocol always
refers to data registers with a starting address number, and a length to indicate how many
registers to transfer.
Campbell Scientific uses 1-based numbering (a common convention for numbering registers in
equipment) in the
ModbusMaster()
instruction. With 1-based numbering, the first data
location is referred to as register number 1. Some equipment uses 0-based numbering (check the
equipment documentation). With 0-based numbering, the first register is referred to as 0.
Reading register numbers can be complicated by the fact that register numbers are often written
with an offset added. Input registers are written with an offset of 30000. So, the first input register
is written as 30001, with 1-based numbering. Holding registers are numbered with an offset of
40000. You must remove the offset before writing the number as the
Start
parameter of
ModbusMaster()
.
There are rare instances when equipment is designed with the registers mapped including the
offset. That means 40001 in the documentation is really register number 40001. Those are rare
instances, and the equipment is deviating from standards. If 1 or 2 don’t work for the Start
parameter, try 40001 and 40002.
7.2.7.2 Coils
Discrete digital I/O channels in Modbus are referred to as coils. The term coil has its roots in
digital outputs operating solenoid coils in an industrial environment. Coils may be read only or
read/write. A read only coil would be a digital input. A read/write coil is used as an output. Coils
are read and manipulated with their own function codes, apart from the registers. Many modern
devices do not utilize coils at all.
7. Communications Protocols
88
Содержание CR1000X
Страница 1: ...Revision 02 21 2019 Copyright 2000 2019 Campbell Scientific ...
Страница 2: ......
Страница 4: ......
Страница 6: ......
Страница 8: ......
Страница 16: ...Appendix A Glossary 176 Appendix B Index 214 Table of Contents viii ...
Страница 20: ...l Smart sensors o SDI 12 o RS 232 o Modbus o DNP3 o TCP IP o RS 485 1 Data acquisition system components 4 ...
Страница 192: ......
Страница 237: ...wiring panel 5 Appendix B Index 220 ...