beautypg.com

2 structure, Table 6. program send options that reset memory, Table 7. data table structures – Campbell Scientific CR800 and CR850 Measurement and Control Systems User Manual

Page 113

background image

Section 7. Installation

113

 

7.7.3.2 Structure

Table CRBasic Program Structure

(p. 113)

delineates CRBasic program structure.

CRBasic example Program Structure

(p. 114)

demonstrates the proper structure of a

CRBasic program.

Table 9. CRBasic Program Structure

Declarations

Define CR800 memory usage. Declare constants,
variables, aliases, units, and data tables.

Declare constants

List fixed constants.

Declare Public variables

List / dimension variables viewable during program
execution.

Dimension variables

List / dimension variables not viewable during
program execution.

Define Aliases

Assign aliases to variables.

Define Units

Assign engineering units to variable (optional).
Units are strictly for documentation. The CR800
makes no use of Units nor checks Unit accuracy.

Define data tables.

Define stored data tables.

Process / store trigger

Set triggers when data should be stored. Triggers
may be a fixed interval, a condition, or both.

Table size

Set the size of a data table.

Other on-line storage devices

Send data to a Campbell Scientific mass-storage
media (USB: drive) if available.

Processing of data

List data to be stored in the data table, e.g. samples,
averages, maxima, minima, etc.
Processes or calculations repeated during program
execution can be packaged in a subroutine and
called when needed rather than repeating the code
each time.

Begin program

Begin program defines the beginning of statements
defining CR800 actions.

Set scan interval

The scan sets the interval for a series of
measurements.

Measurements Enter

measurements

to

make.

Processing

Enter any additional processing.

Call data table(s)

Declared data tables must be called to process and
store data.

Initiate controls

Check measurements and initiate controls if
necessary.

NextScan

Loop back to set scan and wait for the next scan.

End program

End program defines the ending of statements
defining CR800 actions.