Program Structure And Syntax; Declaring Variables; Assigning Values - HP VXI 75000 C Series User's And Scpi Programming Manual

Algorithmic closed loop controller
Table of Contents

Advertisement

Program Structure and Syntax

Declaring Variables

Assigning Values

Chapter 5
In this section you will learn the portion of the 'C' programming language
that is directly applicable to the HP E1415' Algorithm Language. To do this
we will compare the 'C' Algorithm Language elements with equivalent
BASIC language elements.
In BASIC you usually use the DIM statement to name variables and allocate
space in memory for them. In the Algorithm Language you specify the
variable type and a list of variables:
BASIC
DIM a, var, array(3)
Here we declared three variables. Two simple variables; a, and var, and a
single dimensioned array; array.
Comments:
Note that the 'C' language statement must be terminated with the
semicolon ";".
Although in the Algorithm Language all variables are of type float,
you must explicitly declare them as such.
All variables in your algorithm are static. This means that each time
your algorithm is executed, the variables "remember" their values
from the previous execution. The static modifier must appear in the
declaration.
Array variables must have a single dimension. The array dimension
specifies the number of elements. The lower bound is always zero (0)
in the Algorithm Language. Therefore the variable My_array from
above has three elements; My_array [0] through My_array[2].
BASIC and 'C' are the same here. In both languages you use the symbol "="
to assign a value to a simple variable or an element of an array. The value
can come from a constant, another variable, or an expression. Examples:
a = 12.345;
a = My_var;
a = My_array[ 2 ];
a = (My_array[ 1 ] + 6.2) / My_var;
NOTE
In BASIC the assignment symbol "=" is also used as the comparison
operator "is equal to". For example; IF a=b THEN ... . As you will read a
little further on, 'C' uses a different symbol for this comparison.
'C'
static float a, var, array[ 3 ];
Algorithm Language Reference
147

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vxi e1415a

Table of Contents