beautypg.com

1 scan instruction, 2 subscan – Campbell Scientific CR9000X Measurement and Control System User Manual

Page 153

background image

Section 4. CRBasic – Native Language Programming

4.2.9.1 Scan Instruction

The Scan instruction determines how frequently the measurements within the
scan are made. The Scan instruction has four parameters. The Interval is the
interval between scans. Units are the time units for the interval. The maximum
scan interval is one minute and the minimum scan interval is 10 microseconds.
The BufferSize is the size, in number of Scans, of the buffer in RAM which
will hold the raw measurements. Using a buffer allows the processing in the
Scan to lag behind the measurements without affecting the measurement timing.
Count is the number of scans to make before proceeding to the instruction
following NextScan. A count of 0 means to continue looping forever (or
until ExitScan, Subroutine Call, Slow Sequence power down, etc.).

Scan(Interval, Units, BufferSize, Count)
Scan(1,MSEC,3,0)

In Example 4.2.9-1 the scan is 1 millisecond, processing can lag behind
measurements by three scans, and the measurements and output continue
indefinitely.

EXAMPLE 4.2.9-1: CRBasic Code: Scan

BeginProg

'Beginning of Executable Portion

Scan(1,mSec,3,0)

'Measurements and processing here

CallTable Table1

'Call Data Table

NextScan

Loop up for next Scan

EndProg

See Section 9.1 Program Structure/Control for information on the Scan
instruction.

4.2.9.2 SubScan

If used, the SubScan /NextSubScan instructions must be placed within the
Scan/NextScan construct in a CRBasic program. It gives the user the ability to
make measuremements/processing at a faster or slower rate than the main Scan
Rate. This is especially important when making measurements using the
CR9052 Filter module or the CR9058E Isolation module.

There are three unique types of SubScans: the Filter Module subScan, the
Isolation Module subscan, and the Measurement loop subscan. All three
types use the same SubScan/EndSubScan instructions, they just vary in how
they are setup. The parameters of the SubScan instruction are SubInterval,
Units, SubRatio:

SubScan(SubInterval,Units,Subratio)
Measurements
Processing and Table Calls
EndSubScan

See Section 9.1 Program Structure/Control for information on the SubScan
instruction.

4-25