them as the Variable parameter in
ModbusMaster()
. Select the appropriate
ModbusOption
to avoid post-processing.
Unsigned 32-bit integer
Unsigned 32-bit integers require two registers per value. Declare your variables as type Long
before using them as the
Variable
parameter in
ModbusMaster()
. The Long data type is a
signed integer, and does not have a range equal to that of an unsigned integer. If the integer
value exceeds 2,147,483,647 it will display incorrectly as a negative number. If the value does not
exceed that number, there are no issues with a variable of type Long holding it.
32-Bit floating point
32-bit floating point values use 2 registers each. This is the default FLOAT data type in Campbell
Scientific dataloggers . Select the appropriate
ModbusOption
to avoid post-processing.
7.2.8 Modbus tips and troubleshooting
Most of the difficulties with Modbus communications arise from deviations from the standards,
which are not enforced within Modbus. Whether you are connecting via Modbus to a solar
inverter, power meter, or flow meter, the information provided here can help you overcome the
challenges, and successfully gather data into a Campbell datalogger. Further information on
Modbus can be found at:
l
l
l
www.lammertbies.nl/comm/info/modbus.html
7.2.8.1
Error
codes
Modbus
defines
several
error
codes,
which
are
reported
back
to
a
master
from
a
slave.
ModbusMaster()
displays
these
codes
as
a
negative
number.
A
positive
result
code
indicates
no
response
was
received.
Result
code
-01:
illegal
function
The
illegal
function
error
is
reported
back
by
a
Modbus
slave
when
either
it
does
not
support
the
function
at
all,
or
does
not
support
that
function
code
on
the
requested
registers.
Different
devices
support
different
functions
(consult
the
device
documentation).
If
the
function
code
is
supported,
make
sure
you
are
not
trying
to
write
to
a
register
label
l
ed
as
read-only.
It
is
common
for
devices
to
have
holding
registers
where
read-only
and
read/write
registers
are
mapped
next
to
each
other.
7. Communications Protocols
90
Содержание 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 ...