Iftime – Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 184

Advertising
background image

Section 8. Processing and Math Instructions

8-12

Parameter
& Data Type

Enter

Dest
Array

The destination variable array in which to store the fields of the record. The
array must be dimensioned large enough to hold all the fields in the record.

TableName
name

The name of the data table to retrieve the record from.

RecsBack
Const. Or
variable

The number of records back from the most recent record stored to go to
retrieve the record (1 record back is the most recent).

IfTime

The IfTime instruction is used to return a number indicating True (-1) or False
(0) based on the datalogger's real-time clock.

Syntax

IfTime (TintoInt, Interval, Units)

The IfTime function returns True (-1) or False (0) based on the scan clock.
Time is kept internally by the datalogger as the elapsed time since January 1,
1990, at 00:00:00 hours. The interval is synchronized with this elapsed time
(i.e., the interval is true when the Interval divides evenly into this elapsed
time). The time into interval allows an offset to the interval. The IfTime
instruction can be used to set the value of a variable or it can be used as an
expression for a condition.

The scan clock that the IfTime function checks has the time resolution of the
scan interval (i.e., it remains fixed for an entire scan and increments for the
next scan). IfTime must be within a scan to function.

The window of time in which the IfTime instruction is true is 1 of its specified
Units. For example, if IfTime specifies 0 into a 10 minute interval, it could be
true when the scan clock specified any time within the first minute of the ten
minute interval. With 0 into a 600 second interval, the interval is still 10
minutes but it could only be true during the first 1 second of that interval.

IfTime will only return true once per interval. For example, a program with a
1 second scan that tests IfTime(0,10, min) -- 0 minutes into a 10 minute
interval – each scan will execute the instruction 60 times during the minute that
it could be true. It will only return true the first time that it is executed, it will
not return true again until another interval has elapsed.

Advertising