Timer – Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 226

Advertising
background image

Section 9. Program Control Instructions

9-20

'The Thermocouples are connected to differential channels 1-6.

'Declare Variables:
Public TRef, TCTemp(6), PRTResist(16), PRTTemp(16)
Dim I 'Counter for setting Array element to correct value for mux measurement

'Declare Output Table for 15 minute averages:
DataTable (Avg15Min,1,-1)
DataInterval (0,5,Min,10)
Average (1,TRef,IEEE4,0)
Average (6,TCTemp(),IEEE4,0)
Average (16,PRTTemp(),IEEE4,0)
EndTable

BeginProg
Scan (1,Sec,3,0)
PanelTemp (TRef,250)
TCDiff (TCTemp(),6,mV20C ,1,TypeT,TRef,True ,0,250,1.0,0)
Portset (1 ,1 )

'Enable Multiplexer

I=0
SubScan(0,sec,16)
'Pulse port (Set High, Delay, Set Low) to clock multiplexer
Portset (2,1 )
Delay (0,20,mSec)
Portset (2,0)
I=I+1
'The Resistance measurement measures the PRT resistance:
Resistance (PRTResist(I),1,mV50,7,Ix1,1,500,True ,True ,0,250,0.01,0)
'With a multiplier of 0.01 (1/100) the value returned is the Resistance/Resistance @ 0 deg,
'the required input for the PRT temperature calculation instruction.
NextSubScan
PRT (PRTTemp(1),16,PRTResist(1),1.0,0)
CallTable Avg15Min
NextScan
EndProg

Timer

Used to return the value of a timer.

Remarks
Timer is a function that returns the value of a timer. TimOpt is used to start,
stop, reset and start, stop and reset, or read without altering the state (running
or stopped). Multiple timers, each identified by a different number (TimNo),
may be active at the same time.

Syntax
variable = Timer(1,usec,2)

Advertising