Appendix B. Introduction to CRBasic Programming
B-13
In addition to BASIC syntax, instructions are included in CRBasic to facilitate
measurement and control and to store data.
CRBasic Editor Help
contains a
comprehensive list of these instructions. Measurement instructions set up
CR300 hardware to make measurements and store results in variables. Control
instructions set up CR300 hardware to provide outputs depending on triggers.
Data storage instructions process measurements into averages, maxima,
minima, standard deviation, etc.
Each instruction is a keyword followed by a series of informational parameters
needed to complete the procedure. For example, the instruction for measuring
CR300 panel temperature is:
PanelTemp
(Dest,f
N1
)
PanelTemp
is the instruction name. Two parameters follow:
Dest
, a
destination variable name in which the temperature value is stored; and
f
N1
, the
notch frequency to use. To place the panel temperature measurement in the
variable
RefTemp
, filtering out 60 Hz noise, the syntax is as shown in CRBasic
CRBasic Example B-8. Measurement Instruction Syntax
'This program example demonstrates the use of a single measurement instruction. In this
'case, the program measures the temperature of the CR300 processing board.
Public
RefTemp
'Declare variable to receive instruction
BeginProg
Scan
(1,Sec,3,0)
PanelTemp
(RefTemp,60)
'Instruction to make measurement
NextScan
EndProg
B.8.1 Argument Types
Most CRBasic commands or instructions, have subcommands or parameters.
Parameters are populated by the programmer with arguments. Many
instructions have parameters that allow different types of arguments. Common
argument types are listed below. Allowed argument types are specifically
identified in the description of each instruction in
CRBasic Editor Help
.
•
Constant
•
Variable
•
Array
•
Expression
•
Name or list of Names
B.9 Expressions
CRBasic allows for mathematical and logical expressions. Mathematical
operations are written much as they are algebraically. For example, to convert
Celsius temperature to Fahrenheit, the syntax is:
TempF = TempC • 1.8 + 32
Содержание CR300 series
Страница 2: ......
Страница 6: ......
Страница 68: ...CR300 Series Datalogger 58...
Страница 70: ......
Страница 85: ......