beautypg.com

7 multiple data intervals in data tables, Figure 48: data from trigvar program – Campbell Scientific CR200/CR200X-series Dataloggers User Manual

Page 138

background image

Section 11. Programming Resource Library

CRBASIC EXAMPLE. Using TrigVar to Trigger Data Storage

(p. 126) lists

CRBASIC code that uses TrigVar () rather than DataInterval () to trigger data

storage.

FIGURE. Data from TrigVar Program

(p. 126) shows data produced by

the example code.

CRBASIC EXAMPLE 19.

Using TrigVar to Trigger Data Storage

In this example, the variable "counter" is incremented by 1 each scan. The data table is c

includes the Sample (), Average (), and Totalize () instructions. TrigVar is true when

Data are stored when TrigVar is true. Data stored are the sample, average, and total o

which is equal to 0, 1, 2, 3, or 4 when the data table is called.

Public counter

DataTable (Test,counter=2 or counter=3,100)

Sample (1,counter,FP2)

Average (1,counter,FP2,False)

Totalize (1,counter,FP2,False)

EndTable

BeginProg

Scan (1,Sec,0,0)

counter = counter+1

If counter = 5 Then

counter = 0

EndIf

CallTable Test

NextScan

EndProg

Figure 48: Data from TrigVar Program

11.7 Multiple Data Intervals in Data Tables

The trigger variable may be used to set conditions where data is written to a data

table on more than one time interval.

CRBASIC EXAMPLE. Programming for

Two Data Intervals in One Data Table

p. 127 shows how this is done. Rather

than using the DataInterval instruction, output times are specified by inserting If

126