04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Section 8. Operation<br />

Syntax<br />

MoveBytes(Dest, DestOffset, Source, SourceOffset, NumBytes)<br />

8.6.2.3.3 Addressing (ModbusAddr)<br />

Modbus devices have a unique address in each network. Addresses range from 1<br />

to 247. Address 0 is reserved for universal broadcasts. When using the NL100,<br />

use the same number as the Modbus and PakBus® address.<br />

8.6.2.3.4 Supported Function Codes (Function)<br />

Modbus protocol has many function codes. <strong>CR1000</strong> commands support the<br />

following.<br />

Table 90. Supported Modbus Function Codes<br />

Code Name Description<br />

01 Read coil/port status Reads the on/off status of discrete output(s) in the ModBusSlave<br />

02 Read input status Reads the on/off status of discrete input(s) in the ModBusSlave<br />

03 Read holding registers Reads the binary contents of holding register(s) in the ModBusSlave<br />

04 Read input registers Reads the binary contents of input register(s) in the ModBusSlave<br />

05 Force single coil/port Forces a single coil/port in the ModBusSlave to either on or off<br />

06 Write single register Writes a value into a holding register in the ModBusSlave<br />

15 Force multiple coils/ports Forces multiple coils/ports in the ModBusSlave to either on or off<br />

16 Write multiple registers Writes values into a series of holding registers in the ModBusSlave<br />

8.6.2.3.5 Reading Inverse-Format Registers<br />

Some Modbus devices require reverse byte order words (CDAB vs. ABCD). This<br />

can be true for either floating point, or integer formats. Since a slave <strong>CR1000</strong><br />

uses the ABCD format, either the master has to make an adjustment, which is<br />

sometimes possible, or the <strong>CR1000</strong> needs to output reverse-byte order words. To<br />

reverse the byte order in the <strong>CR1000</strong>, use the MoveBytes() instruction as shown<br />

in the sample code below.<br />

for i = 1 to k<br />

MoveBytes(InverseFloat(i),2,Float(i),0,2)<br />

MoveBytes(InverseFloat(i),0,Float(i),2,2)<br />

next<br />

In the example above, InverseFloat(i) is the array holding the inverse-byte ordered<br />

word (CDAB). Array Float(i) holds the obverse-byte ordered word (ABCD).<br />

8.6.2.4 Troubleshooting<br />

Test Modbus functions on the <strong>CR1000</strong> with third party Modbus software. Further<br />

information is available at the following links:<br />

• www.simplyModbus.ca/FAQ.htm<br />

• www.Modbus.org/tech.php<br />

• www.lammertbies.nl/comm/info/modbus.html<br />

370

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!