Registers; Coils; Data Types - Campbell CR300 Series Product Manual

Compact datalogger
Hide thumbs Also See for CR300 Series:
Table of Contents

Advertisement

See the CRBasic Editor help for detailed instruction information and program examples:
https://help.campbellsci.com/crbasic/cr300/.

15.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
ModbusMaster()
equipment) in the
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.

15.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 use coils at all.
When working with coils, the data logger requires Boolean variables. When reading coils, each
Boolean in an array will hold the state of one coil. A value of True will set the coil, a value of
False will unset the coil.

15.2.7.3 Data Types

Modbus does not restrict what data types may be contained within holding and input registers.
Equipment manufacturers need to indicate what binary data types they are using to store data.
Registers are 16-bit, so 32-bit data types use 2 registers each. Some devices combine more
ModbusMaster()
registers together to support longer data types like strings. The
instruction
has a ModbusOption parameter that supports several different data types.
15. Communications protocols
93

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cr300Cr310

Table of Contents