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 />

CRBasic Example 44.<br />

NSEC — Two Element Time Array<br />

'TimeStamp is retrieved into variables TimeOfMaxVar(1) and TimeOfMaxVar(2). Because<br />

'the variable is dimensioned to 2, NSEC assumes,<br />

'1) TimeOfMaxVar(1) = seconds since 00:00:00 1 January 1990, and<br />

'2) TimeOfMaxVar(2) = μsec into a second.<br />

'Declarations<br />

Public PTempC<br />

Public MaxVar<br />

Public TimeOfMaxVar(2) As Long<br />

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

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

Maximum(1,PTempC,FP2,False,True)<br />

EndTable<br />

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

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

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

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

EndTable<br />

'Program<br />

BeginProg<br />

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

PanelTemp(PTempC,250)<br />

MaxVar = FirstTable.PTempC_Max<br />

TimeOfMaxVar = FirstTable.PTempC_TMx<br />

CallTable FirstTable<br />

CallTable SecondTable<br />

NextScan<br />

EndProg<br />

CRBasic Example 45.<br />

NSEC — Seven and Nine Element Time Arrays<br />

'Application: Demonstrate how to sample a time stamp into Final Data Storage using<br />

'an array dimensioned 7 or 9.<br />

'Solution:<br />

'A time stamp is retrieved into variable rTime(1) through rTime(9) as year, month, day,<br />

'hour, minutes, seconds, and microseconds using the RealTime() instruction. The first<br />

'seven time values are copied to variable rTime2(1) through rTime2(7). Because the<br />

'variables are dimensioned to 7 or greater, NSEC assumes the first seven time factors<br />

'in the arrays are year, month, day, hour, minutes, seconds, and microseconds.<br />

225

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

Saved successfully!

Ooh no, something went wrong!