Campbell Scientific CR9000X Measurement and Control System User Manual
Page 161

Section 4. CRBasic – Native Language Programming
If the multiplier and/or offset are specified by a constant, a single
element variable (not an array), or a specific element of an array
(Mult(2)), then the same multiplier and/or offset are used for each
repetition.
If you want to step through from a specific array element other
than the first element, you must insert empty parenthesis
following the parameter: Mult(2)(). Mult() results in the same
action as Mult(1)() (steps through the array starting with the first
element).
Example 4.2.10-1 sets up a single VoltSE measurement to
measure 3 sensors that all have unique calibration factors.
EXAMPLE 4.2.10-1 Multiplier and Offset Arrays
BeginProg
'Calibration factors:
Mult(1)=0.123 : Offset(1)= 0.23
Mult(2)=0.115 : Offset(2)= 0.234
Mult(3)=0.114 : Offset(3)= 0.224
Scan(100,mSec,0,0)
VoltSE(Pressure(),3,mV1000,6,1,30,100,Mult(),Offset())
Next Scan
EndProg
Example 4.2.10-2 measures 6 Type T thermocouples at 1000 Hz,
sends the results to a variable array (TC(6)) in engineering units
Celsius, and stores the data in a data table called Table1.
EXAMPLE 4.2.10-2; CRBasic Code: TCDiff
Public RefTemp, TC(6), Tavg
Public Flag(1)
DataTable(Table1,True,2000)
DataInterval(0,100,msec,10)
CardOut(0,-1)
Average(1,RefTemp,fp2,0)
Average(6,TC(),fp2,0)
EndTable
BeginProg
Scan(1,MSEC,3,0)
ModuleTemp(RefTemp,1,4,0)
TCDiff(TC(),6,mV50,4,1,TypeT,RefTemp,1,30,40,1,0)
TAvg = (TC(1) + TC(2) + TC(3) )/3
If Tavg > 80 then Flag(1) = True
CallTable Table1
'Call Data Table
NextScan
‘Loop up for next Scan
EndProg
Data TableSetup
Declare Variables
Scan loop
4-33