Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

CS106 Sensor


wx2day Aug 14, 2012 01:40 PM

I'm collecting baromeric pressure every 15 minutes using a Vaisala PTB-220 barometer. This sensor is being retired and its replacement is the CS106 (PTB110). My existing program code is below:

SequentialMode
PreserveVariables

'Declare Public Variables
Public BPSend As String * 16,BaroIn As String * 16,BaroTransform As String * 16,BaroPress
Units BaroPress = mb
'Define Data Tables
DataTable (TB15Min,True,-1)
DataInterval (0,15,Min,10)
Average (1,BaroPress,IEEE4,(BaroPress < 850 OR BaroPress > 1150))
EndTable

'Main Program
BeginProg
SerialOpen (Com1,1200,0,10000,250)
BPSend = "SEND" + CHR(13)
Scan (5,Sec,0,0)

'Measure the Barometric Pressure Sensor
SerialFlush (Com1)
SerialOut (Com1,BPSend,0,0,0)
SerialIn (BaroIn,Com1,50,104,25)
SplitStr (BaroTransform,BaroIn,0,1,0)
BaroPress = BaroTransform
If BaroPress >= 1150 OR BaroPress = NAN Then BaroPress = 9999.0

CallTable (TB15Min)
NextScan
EndProg

The manual states there are two modes the CS106 can operate in shut down or manual mode. The manual only gives a programming example for the shutdown mode configuration.

QUESTIONS: 1) Will the following code below be sufficient to perform the same measurement above for manual mode?
2) What is the function of this code WriteIO (&b1000,&b0)?


'CR1000 Datalogger
SequentialMode
Public CS106_temp,BaroPress
Units BaroPress = mb
'Define Data Table
DataTable (TB15Min,True,-1)
DataInterval (0,15,Min,10)
Average (1,BaroPress,IEEE4,(BaroPress < 850 OR BaroPress > 1150)))
EndTable
BeginProg
Scan (5,sec,0,0)
VoltSe (CS106_temp,1,mV2500,1,False,0,_60Hz,0.240,500)
BaroPress = CS106_temp
WriteIO (&b1000,&b0)
CallTable TB15Min
NextScan
EndProg

Thanks in advance,
Wx2day


Dana Aug 15, 2012 06:42 PM

In the program that is in the manual, there are two WriteIO instructions -- one to turn power on for the CS106 and another to turn power off (your program above is only setting the port low). WriteIO is used rather than PortSet so that the program can be compiled in PipelineMode.

The example program has been written to measure the sensor every scan, but only turn the sensor on once an hour. This means that every scan you are getting "bad values" except when the sensor is turned on. The bad value is being held in a temporary variable, and then when the sensor is ON and the measurement is "good", the good temp value is being copied into the variable Pressure.

All this is done, I suppose, so that the program will run in PipelineMode, rather than SequentialMode. Pipeline is faster, but unless your application requires subsecond data, or you're measuring a boatload of sensors, I would take the simpler route offered by the program created by SCWin (don't ask me to define "boatload" -- I'm a software person, not hardware! :)).

SCWin can be downloaded free of charge from our web site.

Dana W.

Log in or register to post/reply in the forum.