beautypg.com

Programming examples, 1 cr1000 program example, 2 cr200(x) programming – Campbell Scientific 237-L Leaf Wetness Sensor User Manual

Page 8

background image

Model 237 Leaf Wetness Sensor

4. Programming Examples

Each example program measures leaf wetness and outputs a sample resistance
and a time fraction the sensor is wet. In these examples, the output interval is
set to 60 minutes, so a time fraction wet of .33 is equivalent to 20 minutes
during that hour. Wetness threshold is set at 150 kΩ.

4.1 CR1000 Program Example

Public Vs_Vx
Public Rs_kOhms

DataTable(Wetness,true,-1)
OpenInterval
DataInterval(0,60,Min,10)

Sample(1, Rs_kOhms, FP2)

Histogram(Rs_kOhms, FP2, 0, 1, 001, 1 , 0, 150)

'Enter threshold in 8th parameter

EndTable

BeginProg
Scan(60,Sec,

3,

0)

BRHalf(Vs_Vx, 1, mV25, 1, VX1, 1, 2500, True, 0, 250, 1, 0)

Rs_kOhms = (1 / Vs_Vx) - 101

CallTable

Wetness

NextScan
EndProg

4.2 CR200(X) Programming

'CR200(X) Series Datalogger
Public Vs_Vx
Public Rs_kOhm
Public ScanIntervalWet
Public ScanIntervalSum
Public TimeFractionWet

DataTable (Wetness,1,-1)
DataInterval

(0,60,min)

'Interval must match IfTime interval (below)

Sample

(1,Rs_kohm)

Sample

(1,TimeFractionWet)

EndTable

BeginProg
Scan

(1,Min)


'Measure

Wetness

ExDelSE(Vs_Vx,1,1,1,mV2500,500,.0004,0)

'Zero measurement when measurement < 0

If Vs_Vx < 0 Then Vs_Vx = 0

Rs_kOhm = (1 / Vs_Vx) - 101


'Sum

Scan

Intervals

ScanIntervalSum

=

ScanIntervalSum + 1

4