- 22 -
SYNTAX
The syntax used tends to follow that of the C programming language:
individual statements end with a semicolon
more than one statement may be put on a line
curly braces {} define a block of code that is associated with the
previous command
Variables and sensors must be defined before they can be used
all programming language commands are in upper case (the
opposite of c)
Variable and sensor names are case sensitive
In order to keep the programming language simple to understand, many common
high level language features have been excluded:
subroutines are not allowed
go to statements are not supported
no loops are allowed except those implied by the EVERY
command
all sensor readings and variables are single precision floating point
numbers
all timer times are long integers in seconds
no switch or case statements
Use the examples that follow as a guide for the above rules. In order to make the
examples clearer, we have expanded them to use one statement per line, but this is
not required. Similarly, indentation could be used to clarify the relationships within a
complex program, but this is up to the user. Try to make your program readable, it
makes later maintenance much easier.
A SIMPLE EXAMPLE:
The fundamental mode of data logging is to record data at regular intervals. The
following example reads two sensors every minute (60 seconds) and stores the data.
EVERY 60
{
LOG(RnCnt, Telem);
}
The EVERY 60 tells the data logger to set up a timer that is triggered every 60
seconds. This time is synchronized to midnight, so in the above example, the first
reading would be at 00:01:00, the second reading at 00:02:00, and so on throughout
the day. When the timer is triggered, then all the code inside the curly braces {} is
executed. In this case it is the single LOG() command.
The LOG() command tells the data logger to read the two sensors called RnCnt and
Telem and store their values. The stored record consists of a time tag that is the time
that the timer timed out, the two data points, and a value which tells the data
extraction routines which LOG() command it refers to. This allows the data to be
associated correctly with the data name.
Содержание HDL1
Страница 1: ...HDL1 HDL1 G5 Data Logger Operating Manual...
Страница 2: ......
Страница 8: ...iv THIS PAGE INTENTIONALLY LEFT BLANK...
Страница 12: ...4 THIS PAGE INTENTIONALLY LEFT BLANK...
Страница 20: ...12 THIS PAGE INTENTIONALLY LEFT BLANK...
Страница 42: ...34 THIS PAGE INTENTIONALLY LEFT BLANK...