Section 11. Programming Resource Library
126
CRBASIC EXAMPLE. Using TrigVar to Trigger Data Storage (p. 126) lists
CRBASIC code th
at uses TrigVar () rather than DataInterval () to trigger data
storage. FIGURE. Data from TrigVar Program (p. 126) shows data produced by
the exam
ple 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
includes the Sample (), Average (), and Totalize () instructions. TrigVar is true whe
Data are stored when TrigVar is true. Data stored are the sample, average, and total
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
th
an using the DataInterval instruction, output times are specified by inserting If