I've got a cr1000 hooked up to a rangefinder for new snowfall depth.
It scans every 5 seconds, and records the reading from the rangefinder in a New_Snow variable.
I want to program in a rolling 24-hr total. The easiest way to do this would be to read the record exactly 24 hrs prior to the current scan, take the difference, and voila, you have how much new snowfall occured in the last 24 hrs.
My issue is...
How do you retreive a specfic record on the datalogger on the program side of things (Say to write it out to a table?)
Hi,
for example:
IF IFTime (0,24,Hr) Then ' at every midnight
Delta=last_snow-new_snow 'calculates the difference
last_snow=new_snow 'updates the data for tomorrow
endif
Of course the first day does not work, unless you enter, the current value in last_snow variable.
Also need to be sure that the measurements are stable, from the measures every 5 sec, I would get an average, per minute, for example, and then I would use it, in the daily calculation.
Smile
Take a look at the data table access topic in the CRBasic help file. You basically use the syntax:
Variable = TableName.FieldName(1,1)
This will pull a specific record out of a table and store it in a variable.
In your specific example you could use:
NewSnow = TableName.SnowDepth(1,1) - Tablename.SnowDepth(1,24)
where (1,1) is the most recent record and (1,24) would be the value 24 hours back (assuming it is an hourly table). The first 1 in (1,1) is the array index and the second value is the number of records to go back.
Dana
Also, take a look at this blog post: https://www.campbellsci.com/blog/programmatically-access-stored-data-values