Function Codes; Modbus Information Storage - Campbell CR300 Series Product Manual

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

Advertisement

15.2.6.2 Function codes

A function code tells the slave which storage entity to access and whether to read from or write to
that entity. Different devices support different functions (consult the device documentation for
support information). The most commonly used functions (codes 01, 02, 03, 04, 05, 15, and 16 )
are supported by Campbell Scientific data loggers.
Most users only require the read- register functions. Holding registers are read with function
code 03. Input registers are read with function code 04. This can be confusing, because holding
registers are usually listed with an offset of 40,000 and input registers with an offset of 30,000.
Don't mix up the function codes. Double check the register type in the device documentation.
Function Code
01 (01 hex)
05 (05 hex)
Write single
15 (0F hex)
Write multiple Discrete Output Coils
02 (02 hex)
04 (04 hex)
03 (03 hex)
06 (06 hex)
Write single
16 (10 hex)
Write multiple
The write-register functions will only work on holding registers. Function 06 only changes one 16-
bit register, whereas function 16, changes multiple registers. Note, when writing registers, the
Variable parameter for the
destination.

15.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:
Coils – 1-bit registers, used to control discrete outputs (including Boolean values),
l
read/write.
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
l
requirement for "holding" data; read/write.
Action
Entity
Read
Discrete Output Coils
Discrete Output Coil
Read
Discrete Input
Read
Input Registers
Read
Holding Registers
Holding Register
Holding Registers
ModbusMaster()
instruction refers to a source, not a
15. Communications protocols
92

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cr300Cr310

Table of Contents