4.3 Declarations
The declarations at the beginning of an CRBASIC program are like an abstract for
the user to know about the parameters of capital importance. This enfoldes the sen-
sors with their port-usage at the data logger, peripheral devices, both measurement
and data storge characteristics. However, this program segment has nothing to do
with the actual program run and just gives an account of readings and terms.
4.3.1 Variables and Arrays
A variable is a packet of memory, given an alphanumeric name, through which
measurements and processing results pass during the program execution. Variables
are declared either as PUBLIC, ALIAS or DIM at the discretion of the programmer.
PUBLIC and ALIAS variables can be viewed through the CR1000KD or software
numeric monitors. DIM variables cannot but are not to be used for programming
the instrumentation of the weather station. The amount of variables depends on
the number of sensors and calculation processes which are to be done. First of all,
every sensor gets his own variable. If there are any calculations in the runtime of
the main scan, this result has to be assigned to annother variable. For example the
variables for the counter of measured data per interval are expressed as following:
Public N
Public Count
When a variable is declared, several variables of the same root name can also be
declared. This is done by adding a suffix of "(x)" to the alphanumeric name, wich
creates an array of x number of variables that differ only by the incrementing number
in the suffix. For example, rather than declaring some similar variables as follows,
Public T107_C_1
Public T107_C_2
Public TRHData_1
Public TRHData_2
Alias TRHData_1=TempC
Alias TRHData_2=HumidC
37
Commentaires sur ces manuels