17.3.3 Avoiding time skew
Time skew between consecutive measurements is a function of settling and integration times,
ADC, and the number entered into the
Reps
parameter of CRBasic instructions. A close
approximation is:
time skew = reps * (settling time + integration time + ADC time) + instruction setup
time
where ADC time equals 170 µs, and instruction setup time is 15 µs.
If reps (repetitions) > 1 (multiple measurements by a single instruction), no setup
time is required. If reps = 1 for consecutive voltage instructions, include the setup
time for each instruction.
Time-stamp skew is not a problem with most applications because:
l
Program execution times are usually short; so, time-stamp skew is only a few milliseconds.
Most measurement requirements allow for a few milliseconds of skew.
l
Data processed into averages, maxima, minima, and so forth are composites of several
measurements. Associated time stamps only reflect the time of the scan when processing
calculations were completed; so, the significance of the exact time a specific sample was
measured diminishes.
Applications measuring and storing sample data wherein exact time stamps are required can be
adversely affected by time-stamp skew. Skew can be avoided by:
l
Making measurements in the scan before time-consuming code.
l
Programming the data logger such that the time stamp reflects the system time rather than
the scan time using the
DataTime()
instruction. See the CRBasic Editor help for detailed
instruction information and program examples:
https://help.campbellsci.com/crbasic/cr300/.
17.4 CRBasic program errors
Analyze data soon after deployment to ensure the data logger is measuring and storing data as
intended. Most measurement and data-storage problems are a result of one or more CRBasic
program bugs. Watch a video:
CRBasic | Common Errors - Identifying and fixing common errors
in the CRBasic programming language
17. Tips and troubleshooting
123