04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Section 8. Operation<br />

RTU / PLC<br />

Remote Telemetry Units (RTUs) and Programmable Logic Controllers<br />

(PLCs) were at one time used in exclusive applications. As technology<br />

increases, however, the distinction between RTUs and PLCs becomes<br />

more blurred. A <strong>CR1000</strong> fits both RTU and PLC definitions.<br />

8.6.2.3 Programming for Modbus<br />

8.6.2.3.1 Declarations<br />

Table CRBasic Ports, Flags, Variables, and Modbus Registers (p. 369) shows the<br />

linkage between <strong>CR1000</strong> ports, flags and Boolean variables and Modbus<br />

registers. Modbus does not distinguish between <strong>CR1000</strong> ports, flags, or Boolean<br />

variables. By declaring only ports, or flags, or Boolean variables, the declared<br />

feature is addressed by default. A typical CRBasic program for a Modbus<br />

application will declare variables and ports, or variables and flags, or variables<br />

and Boolean variables.<br />

Table 89. CRBasic Ports, Flags, Variables, and, Modbus Registers<br />

<strong>CR1000</strong> Feature<br />

Example CRBasic<br />

Declaration<br />

Equivalent Example<br />

Modbus Register<br />

Control Port (Port) Public Port(8) 00001 to 00009<br />

Flag Public Flag(17) 00001 to 00018<br />

Boolean Variable<br />

Variable<br />

Public ArrayB(56) as<br />

Boolean<br />

Public ArrayV(20)*<br />

00001 to 00057<br />

40001 to 40041* or<br />

30001 to 30041*<br />

*Because of byte-number differences, each <strong>CR1000</strong> domain variable translates to two Modbus<br />

domain input / holding registers.<br />

8.6.2.3.2 CRBasic Instructions - Modbus<br />

Complete descriptions and options of commands are available in CRBasic Editor<br />

Help.<br />

ModbusMaster()<br />

Sets up a <strong>CR1000</strong> as a Modbus master to send or retrieve data from a Modbus<br />

slave.<br />

Syntax<br />

ModbusMaster(ResultCode, ComPort, BaudRate, ModbusAddr,<br />

Function, Variable, Start, Length, Tries, TimeOut)<br />

ModbusSlave()<br />

Sets up a <strong>CR1000</strong> as a Modbus slave device.<br />

Syntax<br />

ModbusSlave(ComPort, BaudRate, ModbusAddr, DataVariable,<br />

BooleanVariable)<br />

MoveBytes()<br />

Moves binary bytes of data into a different memory location when translating<br />

big‐endian to little‐endian data.<br />

369

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

Saved successfully!

Ooh no, something went wrong!