3 measurement loop subscan, 3 slowsequence – Campbell Scientific CR9000X Measurement and Control System User Manual
Page 156

Section 4. CRBasic – Native Language Programming
4.2.9.2.3 Measurement Loop SubScan
This SubScan type is similar to a simple for-next loop, only it can encase
measurement instructions. This SubScan does not run in parallel with the other
instructions in the Scan but, runs through the SubScan the dictated number of
times and then moves on to the next instruction. Thus, sufficient measurement
time is required in the main Scan to run through the SubScan measurements the
number of times specified by the SubScan's SubRatio parameter, along with any
other measurement instructions within the main Scan.
SubInterval: To run at the fastest rate, enter zero for the SubInterval. If it
is desired to run through the Subscan at a specific interval,
then the interval can be entered.
Units:
Units used for the SubInterval.
SubRatio
The number of times to run through the SubScan before
moving onto the next instruction.
Example Program 4.2.9-4 is a program that runs through a SubScan
measurement loop 10 times. The same channel is measured 10 times, with a 1
mSec lag between each measurement (based on SubScan interval). After
running through the SubScan 10 times, the Spatial average of the 10
measurement values is computed and stored, along with the 10 raw values.
Example Program 4.2.9-4: Measurement Loop SubScan
Public Volt(10), Vavg, I
DataTable (Main1,1,1000)
DataInterval (0,0,0,100)
'Synch the output rate to the main Scan rate
Sample (1,VAvg,IEEE4)
'
Output avg of 10 measurements 1 mSec apart
Sample (10,Volt(),IEEE4)
'
Output 10 measurements, 1 mSec apart
EndTable
BeginProg
Scan (10,mSec,10,0)
'Scan once a mSec, 10 Scan buffers
I = 0
SubScan (1,mSec,10)
'Run through SubScan 10 times, 1 mSec apart
I = I + 1
'
10 Volt measurements on same channel
VoltDiff (Volt(I),1,mV5000,4,1,True,0,100,1.0,0)
NextSubScan
AvgSpa (VAvg,10,Volt()) '
Spatial Avg on 10 SubScan measurements
CallTable Main1
'Call Table from main Scan to output at its rate.
NextScan
EndProg
4.2.9.3 SlowSequence
It is possible to run a secondary Scan at a slower rate, simultaneously with the
main Scan. This is done through setting up a SlowSequence program area with
its own Scan instruction. Measurements that are not needed at the rate of the
primary scan interval can be entered into this SlowSequence Scan.
See Section 9.1 Program Structure/Control for information on SlowSequence
Scans.
The most common use of the SlowSequence Scan is for performing temperature
calibration using the BiasComp and Calibrate instructions. BiasComp Measures
bias current and adjusts the bias current DACS accordingly. The Calibration
instruction is used to force calibration of the analog channels under program
control to compensate for errors in voltage measurements due to temperature
swings.
4-28