Data Structures - VXI VT1422A User Manual

Remote channel multi-function dac module user’s and scpi programming manual
Table of Contents

Advertisement

The Static Modifier

Data Structures

Chapter 6
These subtle problems can be avoided by specifically including a decimal
point in decimal constants where an integer operation is not desired. For
example, if either of the constants in the division above is made into 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 VT1422A 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 an algorithm. Treating all variables this way allows an
algorithm to "remember" its previous state. The static variable is local in
scope, but otherwise behaves as a global variable. Also, note that declaring
variables within a compound statement is not permitted.
The VT1422A 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.
Creating and Running Algorithms
211

Advertisement

Table of Contents
loading

Table of Contents