2 sensors which send data out without prompting – Campbell Scientific SDM-SIO4 4-Channel Serial I/O Interface User Manual
Page 52
Section 5. Programming the Datalogger
5-20
;Instantaneous sample form the sensor.
6: Sample (P70)
1:
2
Reps
2:
1
Loc [ number ]
;Average over the 10 minute interval.
7: Average (P71)
1:
2
Reps
2:
1
Loc [ number ]
*Table 2 Program
02: 0.0000
Execution Interval (seconds)
*Table 3 Subroutines
End Program
5.3.2 Sensors Which Send Data Out Without Prompting
It can be very difficult to acquire data from this type of sensor because of the
lack of synchronization with the datalogger program.
For sensors which output data relatively slowly data can be collected by using
special features of the input filters which tell the SDM-SIO4 only to recognize
the start and end of data (using the x and X options – see Section 3). These
options only allow the datalogger to collect data once a complete data set has
been received by the SDM-SIO4 (avoiding problems of collection in mid-
transmission). Thus, by polling the SDM-SIO4 using command 1, it is possible
to see if data has been received and if so use a second call of the datalogger
SDM-SIO4 instruction to collect the available data.
Example CR10X Program without Polling or Interrupts
This simple program is an example for sensors that send data at random
intervals. If no data was available when the datalogger asked for it then -99999
will be put into locations 1 and 2. An IF THEN structure could be used in the
datalogger program to store only values that are not -99999.
A typical filter that could be used is:
fltst 200 "t[data]A5xff"
This filter works as follows:
t[data] – this filter waits for an exact string match before it starts the next filter.
In this case it is waiting for the sensor to send the string ‘data’.
A5 – this filter sets up a 250ms filter time-out. This time-out should be long
enough for the sensor to transmit all of its data.
x – this filter marks the start of the data set. In this case the data set is two
floating point numbers.