beautypg.com

Section 11. programming resource library, 1 remote sensor interface – Campbell Scientific CR200/CR200X-series Dataloggers User Manual

Page 121

background image

Section 11. Programming Resource

Library

11.1 Remote Sensor Interface

The CR200(X) is frequently used as a remote sensor interface for a “Host”

datalogger. Typically, the host datalogger and the sensor(s) (CR200(X)) will

have programs that will enable the sensors to operate with the minimum

quiescent current drain (110 µa). These programs synchronize the CR200(X)

sensors so that they are reporting back the data in designated time slots.

For applications demanding more frequent communication, the get/set variable

instructions in the host datalogger can be used with CR200(X) sensors that are

configured for higher current drain (250 µa for 8 second response; 20 ma for 1

second response).

In the lowest power, synchronized mode, the CR200(X) always initiates

communication. Except when it wakes up to send data, its radio is off, drawing

no power. The host datalogger’s radio will be in a fully on position during the

period of expected sensor communication, ready to receive and respond

instantly.

CRBASIC EXAMPLE 16.

Example Wireless Sensor Program For CR200(X)

Const MT = 20

'Measurement Time (secs) SDI-12 in this Case takes 20 seconds

Const Port = 1

'1 = Radio, 2 = RS-232 To send out data

Const RouterAddr = 1 'the PakBus address of a router, in this Case the same as Host

Const HostAddr = 1

'the PakBus address of the Host datalogger

Const NumVals = 8

'8 Measurements

Const Security = 0

'use non zero If Host datalogger has Security set

Const NumControl = 4

Public Measurements(NumVals) 'sensor values To send

Public Control(NumControl)

'Control values returned from Host

BeginProg

Scan(1, sec)

If TimeUntilTransmit(Port)=MT Then 'If it Is time To measure start Measurement

'applicable Measurements that take MT seconds inserted here

EndIf

NextScan

EndProg

TimeUntilTransmit(port) is a function that returns the number of seconds before

it is time to communicate. It will use information retrieved from the datalogger

to determine the time remaining before its communication time slot.

SendGetData will output an array of measurements to the Host datalogger and

retrieve a time slot, a clock setting, and optionally an array of data from the Host

109