Campbell Scientific CR1000 Measurement and Control System User Manual

Page 225

Advertising
background image

Section 7. Installation

225

 

CRBasic Example 44. NSEC — Two Element Time Array 

'TimeStamp is retrieved into variables TimeOfMaxVar(1) and TimeOfMaxVar(2). Because

'the variable is dimensioned to 2, NSEC assumes,

'1) TimeOfMaxVar(1) = seconds since 00:00:00 1 January 1990, and

'2) TimeOfMaxVar(2) = μsec into a second.

'Declarations

Public

PTempC

Public

MaxVar

Public

TimeOfMaxVar(2)

As Long

DataTable(

FirstTable,True,-1)

DataInterval

(0,1,Min,10)

Maximum

(1,PTempC,FP2,False,True)

EndTable

DataTable

(SecondTable,True,-1)

DataInterval

(0,5,Min,10)

Sample

(1,MaxVar,FP2)

Sample

(1,TimeOfMaxVar,Nsec)

EndTable

'Program

BeginProg

Scan

(1,Sec,0,0)

PanelTemp

(PTempC,250)

MaxVar = FirstTable.PTempC_Max
TimeOfMaxVar = FirstTable.PTempC_TMx

CallTable

FirstTable

CallTable

SecondTable

NextScan

EndProg

 

CRBasic Example 45. NSEC — Seven and Nine Element Time Arrays 

'Application: Demonstrate how to sample a time stamp into Final Data Storage using

'an array dimensioned 7 or 9.

'Solution:

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

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

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

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

'in the arrays are year, month, day, hour, minutes, seconds, and microseconds.

Advertising