Section 9. Datalogger Program Creation with CRBasic Editor
9.4 CRBasic Programming
CRBasic
is a programming language that has some similarities to a structured
BASIC. There are special instructions for making measurements and for
creating tables of output data. The results of all measurements are assigned
variables (given names). Mathematical operations are written out much as they
would be algebraically. This section provides a summary of a program, its
syntax, structure, and sequence. Refer to the datalogger users manual or the
on-line help for detailed information on program instructions.
9.4.1 Programming Sequence
The structure of a datalogger program requires that variables, data tables, and
subroutines be declared before they can be used. The best way to do this is to
put all the variable declarations and output table definitions at the beginning,
followed by the subroutines, and then the program. Below is the typical layout
of a program. Note that the online help has example code for each instruction
to demonstrate the use of the instruction in a program.
Declarations
Make a list of what to measure and calculate.
Declare constants
Within this list, include the fixed constants used,
Declare Public variables
Indicate the values that the user is able to view
while the program is running,
Dimension variables
the number of each measurement that will be
made,
Define Aliases
and specific names for any of the
measurements.
Define data tables
Describe, in detail, tables of data that will be
saved from the experiment.
Process/store trigger
Set when the data should be stored. Are they
stored when some condition is met? Are data
stored on a fixed interval? Are they stored on
a fixed interval only while some condition is
met?
Table size
Set the size of the table in RAM.
Other on-line storage
devices
Should the data also be sent to the external
storage?
Processing of Data
What data are to be output (current value,
average, maximum, minimum, etc.).
Define Subroutines
If there is a process or series of calculations
that needs to be repeated several times in the
program, it can be packaged in a subroutine
and called when needed rather than repeating
all the code each time.
9-18
Summary of Contents for PC400
Page 2: ......
Page 16: ...Section 1 Introduction 1 6...
Page 18: ...Section 2 System Requirements 2 2...
Page 46: ...Section 4 The PC400 Main Screen 4 24...
Page 49: ...Section 5 Split 5 3...
Page 82: ...Section 5 Split 5 36...
Page 114: ...Section 6 View 6 14...
Page 132: ...Section 7 Short Cut Program Generator 7 18...
Page 188: ...Section 9 Datalogger Program Creation with CRBasic Editor 9 30...
Page 230: ...Appendix B Table Based Dataloggers B 12...
Page 249: ......