Data Structures - HP VXI 75000 C Series User's And Scpi Programming Manual

Algorithmic closed loop controller
Table of Contents

Advertisement

The Static Modifier

Data Structures

Chapter 5
When the HP E1415's translator receives this statement, it simplifies it by
adding the two integer constants (5 and 8) and storing the sum of these as the
float constant 13. At algorithm run-time, the float constant 13 is assigned to
the variable "a". No surprises so far. Now analyze this statement;
a = ( 3 / 4 ) * 12;
Again the translator simplifies the expression by performing the integer
divide for 3 / 4. This results in the integer value 0 being multiplied by 12
which results in the float constant 0.0 being assigned to the variable "a" at
run-time. This is obviously not what you wanted but is exactly what your
algorithm instructed.
You can avoid these subtle problems by specifically including a decimal
point in decimal constants where an integer operation is not what you want.
For example, if you had made either of the constants in the division above a
float constant by including a decimal point, the translator would have
promoted the other constant to a float value and performed a float divide
operation resulting in the expected 0.75 * 12, or the value 8.0 So the
statement;
a = ( 3. / 4 ) * 12;
will result in the value float 8.0 being assigned to the variable "a".
All HP E1415 variables, local or global, must be declared as static. An
example:
static float gain_var, integer_var, deriv_var; /* three vars declared */
In 'C', local variables that are not declared as static lose their values once the
function completes. The value of a local static variable remains unchanged
between calls to your algorithm. Treating all variables this way allows your
algorithm to "remember" its previous state. The static variable is local in
scope, but otherwise behaves as a global variable. Also note that you may
not declare variables within a compound statement.
The HP E1415 Algorithm Language allows the following data structures:
Simple variables of type float:
Declaration
static float simp_var, any_var;
Use
simp_var = 123.456;
any_var = -23.45;
Another_var = 1.23e-6;
Storage
Each simple variable requires four 16-bit words of memory.
Single-dimensioned arrays of type float with a maximum of 1024
Algorithm Language Reference
141

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vxi e1415a

Table of Contents