04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Section 7. Installation<br />

produce a time stamp that may be accessed from the program after being<br />

written to a data table. The time of other events, such as alarms, can be stored<br />

using the RealTime() instruction.<br />

• Accessing and storing a time stamp from another datalogger in a PakBus<br />

network.<br />

7.8.10.1 NSEC Options<br />

NSEC is used in a CRBasic program one of the following three ways. In all<br />

cases, the time variable is only sampled with a Sample() instruction, Reps = 1.<br />

1. Time variable is declared As Long. Sample() instruction assumes the time<br />

variable holds seconds since 1990 and microseconds into the second is 0. The<br />

value stored in final data storage is a standard time stamp. See CRBasic<br />

example NSEC — One Element Time Array (p. 224).<br />

2. Time-variable array dimensioned to (2) and As Long — Sample() instruction<br />

assumes the first time variable array element holds seconds since 1990 and the<br />

second element holds microseconds into the second. See CRBasic example<br />

NSEC — Two Element Time Array (p. 225).<br />

3. Time-variable array dimensioned to (7) or (9) and As Long or As Float —<br />

Sample() instruction assumes data are stored in the variable array in the<br />

sequence year, month, day of year, hour, minutes, seconds, and milliseconds.<br />

See CRBasic example NSEC — Seven and Nine Element Time Arrays (p. 225).<br />

CRBasic example NSEC — Convert Time Stamp to Universal Time (p. 224) shows<br />

one of several practical uses of the NSEC data type.<br />

CRBasic Example 43.<br />

NSEC — One Element Time Array<br />

'A time stamp is retrieved into variable TimeVar(1) as seconds since 00:00:00<br />

'1 January 1990. Because the variable is dimensioned to 1, NSEC assumes the value =<br />

'seconds since 00:00:00 1 January 1990.<br />

'Declarations<br />

Public PTemp<br />

Public TimeVar(1) As Long<br />

DataTable(FirstTable,True,-1)<br />

DataInterval(0,1,Sec,10)<br />

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

EndTable<br />

DataTable(SecondTable,True,-1)<br />

DataInterval(0,5,Sec,10)<br />

Sample(1,TimeVar,Nsec)<br />

EndTable<br />

'Program<br />

BeginProg<br />

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

TimeVar = FirstTable.TimeStamp<br />

CallTable FirstTable<br />

CallTable SecondTable<br />

NextScan<br />

EndProg<br />

224

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

Saved successfully!

Ooh no, something went wrong!