04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Section 7. Installation<br />

Figure 75: Data from TrigVar program<br />

CRBasic Example 42.<br />

Using TrigVar to Trigger Data Storage<br />

'In this example, the variable "counter" is incremented by 1 each scan. The data table<br />

'is called every scan, which includes the Sample(), Average(), and Totalize()<br />

'instructions. TrigVar is true when counter = 2 or counter = 3. Data are stored when<br />

'TrigVar is true. Data stored are the sample, average, and total of the variable<br />

'counter, which is equal to 0, 1, 2, 3, or 4 when the data table is called.<br />

Public counter<br />

DataTable(Test,counter=2 or counter=3,100)<br />

Sample(1,counter,FP2)<br />

Average(1,counter,FP2,False)<br />

Totalize(1,counter,FP2,False)<br />

EndTable<br />

BeginProg<br />

Scan(1,Sec,0,0)<br />

counter = counter + 1<br />

If counter = 5 Then<br />

counter = 0<br />

EndIf<br />

CallTable Test<br />

NextScan<br />

EndProg<br />

7.8.10 NSEC Data Type<br />

Data of NSEC data type reside only in final data storage. A datum of NSEC<br />

consists of eight bytes — four bytes of seconds since 1990 and four bytes of<br />

nanoseconds into the second. Nsec is declared in the Data Type parameter in finaldata<br />

storage output-processing instructions (p. 477). It is used in the following<br />

applications.<br />

• Placing a time stamp in a second position in a record.<br />

• Accessing a time stamp from a data table and subsequently storing it as part<br />

of a larger data table. Maximum(), Minimum(), and FileTime() instructions<br />

223

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!