beautypg.com

1 crbasic – Campbell Scientific A6REL-12 Relay Driver User Manual

Page 9

background image

A6REL-12 Relay Driver

5.1 CRBasic

Although the following example is a CR1000 program, other dataloggers that
use CRBasic such as the CR800 and CR3000 are programmed similarly.

'CR1000 Series Datalogger

'Declare Public Variables
Public PTemp, batt_volt, P, TC

'Define Data Tables
DataTable (Test,1,-1)
DataInterval

(0,15,Sec,10)

Minimum

(1,batt_volt,FP2,0,False)

Sample

(1,PTemp,FP2)

Sample

(1,TC,FP2)

EndTable

'Main Program
BeginProg
Scan

(5,Sec,0,0)

Battery

(Batt_volt)

'Measure TC reference temperature

PanelTemp

(PTemp,250)

'Make temperature measurement and convert it to degrees Fahrenheit

TCDiff

(TC,1,mV2_5C,1,TypeT,PTemp,True

,0,250,1.8,32)

'If temperature is greater than 99 set Port low

If

TC>99

then

P=0

'If temperature is less than 96 set Port high

ElseIf

TC<96

then

P=1

EndIf

PortSet

(1

,P)

'Call

Output

Tables

'Example:

CallTable

Test

NextScan
EndProg

5