Campbell Scientific CR9000X Measurement and Control System User Manual

Page 168

Advertising
background image

Section 4. CRBasic – Native Language Programming

In addition to accessing the data actually stored in a table, there are some
pseudo fields related to the data table that can be retrieved:

Tablename.EventEnd(1,1) is only valid for a data table using the DataEvent
instruction, and is only updated when the Table is called.
Tablename.EventEnd(1,1) = -1 (True) TableName.EventEnd = -1 (true) during
a scan when the last record of the data storage event occurs and = 0 (false)
during all other scans. This construct should be placed after the CallTable
instruction for the Table in question. The WorstCase example in Section 6.2
illustrates the use of this syntax.

Tablename.EventCount(1,1) is only valid for a data table using the DataEvent
Instruction. Tablename.EventCount(1,1) = the number of events that have been
completed in the table. An event is complete when the table has stopped storing
data for the event.

Tablename.Output(1,1) = -1 if data were output to the table the last time the
table was called, or = 0 if data were not output. The result from this instruction
is only updated when the table is called.

Tablename.Record(1,n) = the record number of the record output n records
ago.

Tablename.Tablesize(1,1) = the size of the table in records.

Tablename.Timestamp(m,n) = element m of the timestamp output n records
ago. where:The TableName.TimeStamp(m,n) syntax returns the time into an
interval or a timestamp for the record n number of records ago. The name of the
DataTable is entered in place of the TableName parameter. TableName is
limited to 20 characters. The type of timestamp returned is based on the option
specified for m and the format of the variable in which the timestamp is stored:
The timestamp returned has a 10 micro-second resolution.

Syntax: TimeVariable = TableName.TimeStamp(1,1)

When the variable where the timestamp will be stored is declared as a Float or
Long, the result returned is:

timestamp(0,n) = seconds since 1970
timestamp(1,n) = seconds since 1990
timestamp(2,n) = seconds into the current year
timestamp(3,n) = seconds into the current month
timestamp(4,n) = seconds into the current day
timestamp(5,n) = seconds into the current hour
timestamp(6,n) = seconds into the current minute
timestamp(7,n) = microseconds into the current second

When the variable where the timestamp will be stored is declared as a String,
the result returned is the timestamp using the specified formats below:

timestamp(1,n) = “MM/DD/YYYY hh:mm:ss.sssss
timestamp(3,n) = “DD/MM/YYYY hh:mm:ss.sssss”
timestamp(4,n) = "CCYY-MM-DD hh:mm:ss.sssss"

4-40

Advertising