Section 7. Installation
7.9.8 Data Output: Two Intervals in One Data Table
CRBasic Example 33.
Two Data-Output Intervals in One Data Table
'This program example demonstrates the use of two time intervals in a data table. One time
'interval in a data table is the norm, but some applications require two.
'
'A table with two time intervals should be allocated memory as is done with a conditional table:
'rather than auto-allocate, set a fixed number of records.
'Declare Public Variables
Public
PTemp, batt_volt, airtempC, deltaT
Public
int_fast
As Boolean
Public
int_slow
As Boolean
Public
counter(4)
As Long
'Declare Data Table
'
'Table is output on one of two intervals, depending on condition.
'Note the parenthesis around the TriggerVariable AND statements.
DataTable
(TwoInt,(int_fast
AND
TimeIntoInterval
(0,5,Sec))
OR
(int_slow
AND
_
TimeIntoInterval
(0,15,sec)),-1)
Minimum
(1,batt_volt,FP2,0,False)
Sample
(1,PTemp,FP2)
Maximum
(1,counter(1),Long,False,False)
Minimum
(1,counter(1),Long,False,False)
Maximum
(1,deltaT,FP2,False,False)
Minimum
(1,deltaT,FP2,False,False)
Average
(1,deltaT,IEEE4,false)
EndTable
'Main Program
BeginProg
Scan
(1,Sec,0,0)
PanelTemp
(PTemp,250)
Battery
(Batt_volt)
counter(1) = counter(1) + 1
'Measure thermocouple
TCDiff
(AirTempC,1,mV2_5C,1,TypeT,PTemp,True,0,250,1.0,0)
'calculate the difference in air temperature and panel temperature
deltaT = airtempC - PTemp
'When the difference in air temperatures is >=3 turn LED on and trigger the faster of
'the two data-table intervals.
If
deltaT >= 3
Then
PortSet
(4,true)
int_fast = true
int_slow = false
Else
PortSet
(4,false)
int_fast = false
int_slow = true
EndIf
197
Summary of Contents for CR1000
Page 2: ......
Page 4: ......
Page 6: ......
Page 32: ......
Page 36: ......
Page 38: ......
Page 40: ......
Page 60: ...Section 4 System Quickstart Figure 16 PC200W View Line Graph 60 ...
Page 96: ......
Page 98: ...98 ...
Page 302: ......
Page 453: ...Section 8 Operation Figure 115 Using the Keyboard Display 453 ...
Page 456: ...Section 8 Operation Figure 118 Real Time Custom 456 ...
Page 457: ...Section 8 Operation 8 8 1 3 Final Memory Tables Figure 119 Final Memory Tables 457 ...
Page 458: ...Section 8 Operation 8 8 2 Run Stop Program Figure 120 Run Stop Program 458 ...
Page 460: ...Section 8 Operation Figure 122 File Edit 460 ...
Page 461: ...Section 8 Operation 8 8 4 PCCard Memory Card Display Figure 123 PCCard CF Card Display 461 ...
Page 478: ......
Page 506: ......
Page 536: ......
Page 636: ......
Page 642: ......
Page 644: ......
Page 676: ......
Page 677: ......