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,
depending on whether bits or bytes or other components are ordered from the big end (most
significant bit) or the little end (least significant bit).
In big-endian format, the byte containing the most significant bit is stored first, then the
following bytes are stored in decreasing significance order, with the byte containing the least
significant bit stored last. Little-endian format reverses this order: the sequence stores the least
significant byte first and the most significant byte last. Endinness is used in some Modbus
programming so it is important to note that the CR1000X is a big-endian instrument.
7.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 dataloggers.
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
Action
Entity
01 (01 hex)
Read
Discrete Output Coils
05 (05 hex)
Write single
Discrete Output Coil
15 (0F hex)
Write multiple Discrete Output Coils
02 (02 hex)
Read
Discrete Input
04 (04 hex)
Read
Input Registers
03 (03 hex)
Read
Holding Registers
06 (06 hex)
Write single
Holding Register
16 (10 hex)
Write multiple Holding Registers
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
ModbusMaster()
instruction refers to a source, not a
destination.
7. Communications Protocols
87
Содержание 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 ...