7 execution timing, 1 scan() / nextscan, Table 15. task processes – Campbell Scientific CR800 and CR850 Measurement and Control Systems User Manual
Page 135

Section 7. Installation
135
A similar concern is the reuse of the same variable in multiple tasks. Without 
some sort of messaging between the two tasks placed into the CRBasic program, 
unpredictable results are likely to occur. The SemaphoreGet() and 
SemaphoreRelease() instruction pair provide a tool to prevent unwanted access 
of an object (variable, COM port, etc.) by another task while the object is in use. 
Consult CRBasic Editor Help for information on using SemaphoreGet() and 
SemaphoreRelease(). 
7.7.3.7 Execution Timing
Timing of program execution is regulated by timing instructions listed in the 
following table. 
Table 17. Program Timing Instructions
Instructions General
Guidelines Syntax
Form
Scan() / NextScan
Use in most programs. Begins 
/ ends the main scan. 
BeginProg
Scan()
'.
'.
'.
NextScan
EndProg
SlowSequence /
EndSequence
Use when measurements or 
processing must run at slower 
frequencies than that of the 
main program. 
BeginProg
Scan()
'.
'.
'.
NextScan
SlowSequence
Scan()
'.
'.
'.
NextScan
EndSequence
EndProg
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 CR800 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 
