beautypg.com

B.4.2, Cycle shutter/wiper for each measurement cr1000 – Campbell Scientific OBS500 Smart Turbidity Meter with ClearSensor Technology User Manual

Page 59

background image

Appendix B. Example Programs

B.4.2 Cycle Shutter/Wiper for Each Measurement CR1000

Program

The following CRBasic program will:

Open the shutter if closed, then make a measurement

Make a measurement if open, then close

Shutter/wiper cycles will be cut by 50%. This will reduce wear and power

consumption 50% but still leave the optics shuttered 50% of the time.

'CR1000 Series Datalogger
'OBS500 cycle shutter each measurement

'Declare Public Variables

Public OBS500(4)
Public obsDatOpen(4),obsDatClose(4)
Public Open

'Declare Other Variables
Alias OBS500(1) = turb_bs
Alias OBS500(2) = turb_ss
Alias OBS500(3) = tempC_obs500
Alias OBS500(4) = wet_dry
Alias obsDatOpen(1) = Open_counts 'Full movement of slider is about 20,000 counts. If it jams this # will be smaller
Alias obsDatOpen(2) = Open_Max_mA_cnts ' Number of times the shutter stops while opening because of max current
Alias obsDatOpen(3) = Open_slip 'Open timeout count. If the threads are stripped the slide will not move and this count will increase
Alias obsDatOpen(4) = Open_mA ' mA current of the motor
Alias obsDatClose(1) = Close_counts 'Full movement of slider is about 20,000 counts. If it jams this # will be smaller
Alias obsDatClose(2) = Close_Max_mA_cnts ' Number of times the shutter stops while opening because of max current
Alias obsDatClose(3) = Close_slip 'Open timeout count. If the threads are stripped the slide will not move and this count will increase
Alias obsDatClose(4) = Close_mA ' mA current of the motor

Units turb_bs = fbu
Units turb_ss = fnu
Units tempC_obs500 = degC
Units wet_dry = YesNo

'Define Data Tables
DataTable (Test,1,1000)
DataInterval (0,5,Min,10)
Sample (1,turb_bs,FP2)
Sample (1,turb_ss,FP2)
EndTable

'Main Program
BeginProg

Scan (60,Sec,0,0)

'If open make measurement and close. If closed, open then make measurement.

If Open = 1 Then 'If open the make measurement, then close
SDI12Recorder(OBS500(),1,0,"M4!",1,0)' Measure without moving the wiper
SDI12Recorder (obsDatClose(),1,0,"M7!",1,0)'Close wiper
Open = 0
Else ' if closed
SDI12Recorder (obsDatOpen(),1,0,"M3!",1,0)' Open wiper
Delay (0,11,Sec)
SDI12Recorder(OBS500(),1,0,"M4!",1,0)' Measure without moving the wiper
Open = 1
EndIf

'Call Output Tables
CallTable Test
NextScan
EndProg

B-5