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 />

8.6.2.5 Modbus over IP<br />

Modbus over IP functionality is an option with the <strong>CR1000</strong>. Contact <strong>Campbell</strong><br />

<strong>Scientific</strong> for details.<br />

8.6.2.6 Modbus tidBytes<br />

Q:<br />

A:<br />

Can Modbus be used over an RS‐232 link, 7 data bits, even parity, one<br />

stop bit<br />

Yes. Precede ModBusMaster() / ModBusSlave() with SerialOpen() and<br />

set the numeric format of the COM port with any of the available<br />

formats, including the option of 7 data bits, even parity. SerialOpen()<br />

and ModBusMaster() can be used once and placed before Scan().<br />

Concatenating two Modbus long 16‐bit variables to one Modbus long 32<br />

bit number.<br />

8.6.2.7 Converting 16-bit to 32-bit Longs<br />

Concatenation of two Modbus long 16‐bit variables to one Modbus long<br />

32 bit number is shown in the following example.<br />

CRBasic Example 67.<br />

Concatenating Modbus Long Variables<br />

'Requires CR800 OS v.3, <strong>CR1000</strong> OS v.12, or CR3000 OS v.5 or higher<br />

'<strong>CR1000</strong> uses Big-endien word order.<br />

'Declarations<br />

Public Combo As Long<br />

Public Register(2) As Long<br />

Public Result<br />

'Aliases used for clarification<br />

Alias Register(1) = Register_LSW<br />

Alias Register(2) = Register_MSW<br />

'Variable to hold the combined 32-bit<br />

'Array holds two 16-bit ModBus long<br />

'variables<br />

'Register(1) = Least Significant Word<br />

'Register(2) = Most Significant Word<br />

'Holds the result of the ModBus master<br />

'query<br />

'Least significant word.<br />

'Most significant word.<br />

BeginProg<br />

'If you use the numbers below (un-comment them first)<br />

'Combo is read as 131073 decimal<br />

'Register_LSW=&h0001 'Least significant word.<br />

'Register_MSW=&h0002 ' Most significant word.<br />

371

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

Saved successfully!

Ooh no, something went wrong!