Appendix B. Introduction to CRBasic Programming
B-12
'Reset and Increment Counter
If
Oscillator = 2
Then
Oscillator = 0
Oscillator = Osci 1
'Process and Control
If
Oscillator = 1
If
Flag(1) = True
Then
DisableVar = True
EndIf
Else
DisableVar = False
EndIf
'Call Data Tables and Store Data
CallTable
(OscAvgData)
NextScan
EndProg
B.6 BeginProg / EndProg
BeginProg
defines the beginning of statements defining CR300 actions. Any
instructions between
BeginProg
and
Scan()
are only executed when the
datalogger first runs the program.
EndProg
marks the end of the program.
B.7 Scan() / NextScan
Simple CR300 programs are often built entirely within a single
Scan()
/
NextScan
structure, with only variable and data table declarations outside the
scan.
Scan()
/
NextScan
creates an infinite loop. Each periodic pass through
the loop is synchronized to the CR300 clock.
Scan()
determines how
frequently instructions in the program are executed, as shown in the following
CRBasic code snip:
'Scan(Interval, Units, BufferSize, Count)
Scan
(1,Sec,1,0)
'CRBasic instructions go here
ExitScan
Scan()
has four parameters:
•
Interval
—
the interval between scans. Interval is 1 ms ≤
Interval
≤ 1
day.
•
Units
— the time unit for the interval.
•
BufferSize
— not used in the CR300, but left in for compatibility
reasons.
•
Count
— number of scans to make before proceeding to the
instruction following
NextScan
. A count of
0
means to continue
looping forever (or until
ExitScan
).
B.8 Programming Instructions
Common instructions (called "commands" in BASIC) and operators used in
most BASIC languages, including program control statements and logic and
mathematical operators, can also be used in CRBasic.
Содержание CR300 series
Страница 2: ......
Страница 6: ......
Страница 68: ...CR300 Series Datalogger 58...
Страница 70: ......
Страница 85: ......