Section 4. CRBasic – Native Language Programming
4-9
4.7.1 Expressions in Parameters
Many parameters allow the entry of expressions. If an expression is a
comparison, it will return -1 if the comparison is true and 0 if it is false
(Section 4.5.3). An example of the use of this is in the DataTable instruction
where the trigger condition can be entered as an expression. Suppose the
variable TC(1) is a thermocouple temperature:
DataTable(Name, TrigVar, Size)
DataTable(Temp, TC(1)>100, 5000)
Entering the trigger as the expression, TC(1)>100, will cause the trigger to be
true and data to be stored whenever the temperature TC(1) is greater than 100.
4.7.2 Arrays of Multiplier Offsets for Sensor Calibration
If variable arrays are used as the multiplier and offset parameters in
measurements that use repetitions, the instruction will automatically step
through the multiplier and offset arrays as it steps through the channels. This
allows a single measurement instruction to measure a series of individually
calibrated sensors, applying the correct calibration to each sensor. If the
multiplier and offset are not arrays, the same multiplier and offset are used for
each repetition.
VoltSE(Dest,Reps,Range,ASlot,SEChan,Delay,
Integ,Mult,Offset)
'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
VoltSE(Pressure(),3,mV1000,6,1,1,100,Mult(),Offset()
4.8 Program Access to Data Tables
Data stored in a table can be accessed from within the program. The format
used is:
Tablename.Fieldname(fieldname index,records back)
Where
Tablename
is the name of the table in which the desired value is stored.
Fieldname
is the name of the field in the table. The fieldname is always an
array even if it consists of only one variable; the
fieldname index
must always
be specified.
Records back
is the number of records back in the data table
from the current time (1 is the most recent record stored, 2 is the record stored
prior to the most recent). For example, the expression:
Tdiff=Temp.TC_Avg(1,1)–Temp.TC_Avg(1,101)
could be used in the example program (Section 4.3) to calculate the change in
the 10 ms average temperature of the first thermocouple between the most
recent average and the one that occurred a second (100 x 10 ms) earlier.
Summary of Contents for CR9000
Page 6: ...CR9000 Table of Contents iv This is a blank page ...
Page 22: ...CR9000 Overview OV 16 This is a blank page ...
Page 26: ...Section 1 Installation 1 4 CR9000 FIGURE 1 1 3 CR9000 Battery Pack ...
Page 72: ...Section 3 CR9000 Measurement Details 3 28 This is a blank page ...
Page 88: ...Section 5 Program Declarations 5 6 This is a blank page ...
Page 217: ...This is a blank page ...