Section 8. Operation
480
8.10.3.2.5
Reading Inverse Format Modbus Registers
Some Modbus devices require reverse byte order words (CDAB vs. ABCD).
This can be true for either floating point, or integer formats. Since a slave
CR3000 uses the ABCD format, either the master has to make an adjustment,
which is sometimes possible, or the CR3000 needs to output reverse-byte order
words. To reverse the byte order in the CR3000, use the MoveBytes()
instruction as shown in the sample code below.
for
i = 1
to
k
MoveBytes
(InverseFloat(i),2,Float(i),0,2)
MoveBytes
(InverseFloat(i),0,Float(i),2,2)
next
In the example above, InverseFloat(i) is the array holding the inverse-byte
ordered word (CDAB). Array Float(i) holds the obverse-byte ordered word
(ABCD).
See Endianness
(p. 601).
8.10.3.2.6
Timing
The timeout is a critical parameter of Modbus communication. The response time
of devices is usually not specified by the manufacturer and can range from 100 ms
to more than 5 seconds. When the CR3000 is acting as a slave device, it typically
responds very quickly. The default timeout in a master device polling the CR3000
will typically not need adjustment from the default. When the CR3000 is acting as
a master, the response time of a slave needs particular attention. The best practice
is to monitor the communication between the CR3000 and the slave device with
the comms sniffer (terminal mode
(p. 523)
W command). The comms sniffer allows
you to see the actual response time of the slave device. The TimeOut parameter of
ModbusMaster() can then be adjusted accordingly.
8.10.3.3 Troubleshooting (Modbus)
Test Modbus functions on the CR3000 with third party Modbus software.
Further information is available at the following links:
•
www.simplyModbus.ca/FAQ.htm
•
www.Modbus.org/tech.php
•
www.lammertbies.nl/comm/info/modbus.html
8.10.3.4 Modbus over IP
When the CR3000 acts as the Modbus master, a TCPOpen() instruction must
precede the ModbusMaster() instruction. The connection handle returned by
TCPOpen() is used for the ComPort parameter.
In the case of ModbusSlave(), no TCPOpen() instruction is needed. Simply use
502 for the ComPort parameter.
Summary of Contents for CR3000 Micrologger
Page 2: ......
Page 3: ......
Page 4: ......
Page 6: ......
Page 30: ......
Page 34: ......
Page 36: ......
Page 96: ......
Page 485: ...Section 8 Operation 485 8 11 2 Data Display FIGURE 110 Keyboard and Display Displaying Data ...
Page 487: ...Section 8 Operation 487 FIGURE 112 CR1000KD Real Time Custom ...
Page 491: ...Section 8 Operation 491 FIGURE 116 Keyboard and Display File Edit ...
Page 496: ......
Page 502: ......
Page 564: ...Section 11 Glossary 564 FIGURE 126 Relationships of Accuracy Precision and Resolution ...
Page 566: ......
Page 594: ......
Page 598: ......
Page 600: ......
Page 602: ......
Page 624: ......
Page 642: ......
Page 643: ......