beautypg.com

Programming, 1 cr1000 example – Campbell Scientific DB1 Double Bubbler Liquid Level Sensor User Manual

Page 10

background image

DB1 Liquid Level Measurement Sensor

5. Programming

Every 60 seconds, the following program examples calculate the pressure
transducer multiplier, measure the offset, and measure the liquid level. The
average liquid level is stored in final memory every 15 minutes.

5.1 CR1000 Example

'CRBasic code for CR1000, CR800, or CR850

Public WtrLvl
Public Batt_Volt

Dim i
Dim j
Dim mv
Dim Sum
Dim Mult
Dim Offset
Dim Valve(3)
Dim Delta_mV

Const Delta_H =

'Set Delta_H equal to the vertical difference between the

upper

tube

and

lower

tube.

'Unit of measurement of Delta_H will determine unit of measurement of final output.

'\\\\\\\\\\\\\\\\\\\\\\\\ OUTPUT SECTION ////////////////////////

DataTable(Table1,true,-1
DataInterval(0,5,Min,10)
Sample

(1,WtrLvl,FP2)

EndTable

DataTable(Table2,true,-1)
DataInterval(0,1440,min,10)
Minimum(1,Batt_Volt,FP2,False,True)
EndTable

'\\\\\\\\\\\\\\\\\\\\\\\\\\\ PROGRAM ////////////////////////////

BeginProg

Scan(5,Min, 3, 0)

Battery(Batt_Volt)

For i = 1 To 3

Select Case i

Case 1

PortSet(1,1)

'Open valve to lower tube

Case 2

PortSet(2,1)

'Open valve to upper tube

6