1 scan() / nextscan – Campbell Scientific CR1000 Measurement and Control System User Manual
Page 136

Section 7. Installation
136
Table 17. Program Timing Instructions
Instructions General
Guidelines Syntax
Form
SubScan / NextSubScan
Use when measurements or
processing must run at faster
frequencies than that of the
main program.
BeginProg
Scan()
'.
'.
'.
SubScan()
'.
'.
'.
NextSubScan
NextScan
EndProg
7.7.3.7.1 Scan() / NextScan
Simple CR1000 programs are often built entirely within a single Scan() /
NextScan structure, with only variable and data-table declarations outside the
Scan() / NextScan structure. In these simple programs, Scan() / NextScan creates
an infinite loop, each periodic pass through the loop being synchronized to the
CR1000 clock. Scan() parameters allow modification of the period in 10- ms
increments. As shown in CRBasic example BeginProg / Scan() / NextScan /
EndProg Syntax (p. 136), aside from declarations, the CRBasic program may be
relatively short.
CRBasic Example 15. BeginProg / Scan() / NextScan / EndProg Syntax
BeginProg
Scan
(1,Sec,3,0)
PanelTemp
(RefTemp, 250)
TCDiff
(TC(),6,mV2_5C,1,...)
CallTable
Temp
NextScan
EndProg
Scan() determines how frequently instructions in the program are executed, as
shown in CRBasic example Scan Syntax
(p. 136):
CRBasic Example 16. Scan Syntax
'Scan(Interval, Units, BufferSize, Count)
Scan
(1,Sec,3,0)
·
·
·
ExitScan
Scan() has four parameters:
•
Interval
— the interval between scans.
•
Units
— the time unit for the interval. Interval is 10 ms <= Interval <= 1 day.
•
BufferSize
— the size (number of scans) of a buffer in RAM that holds the
raw results of measurements. When running in Pipeline mode, using a buffer