Creating and Running Algorithms 213Chapter 6
Declaration Initialization Only simple variables can be initialized (not array members) in the
declaration statement:
static float my_var = 2;
NOTE! The initialization of the variable only occurs when the algorithm is first
defined with the ALG:DEF command. The first time the algorithm is
executed (module INITed and triggered), the value will be as initialized.
But when the module is stopped (ABORT command) and then re-INITiated,
the variable will not be re-initialized but will contain the value last assigned
during program execution. In order to initialize variables each time the
module is re-INITialized, see “Determining First Execution (First_loop)” on
page 190.
Global Variables To declare global variables, execute the SCPI command ALG:DEF
'GLOBALS',<program_string>. The <program_string> can contain simple
variable and array variable declaration/initialization statements. The string
must not contain any executable source code.
Language Syntax Summary
This section documents the VT1422A's Algorithm Language elements.
Identifier:
First character is A-Z, a-z or "_", optionally followed by characters; A-Z,
a-z, 0-9 or "_". Only the first 31 characters are significant.
For example: a, abc, a1, a12, a_12, now_is_the_time, gain1
Decimal Constant:
First character is 0-9 or "." (decimal point). Remaining characters if
present are 0-9, a "." (one only), a single "E" or "e", optional "+" or "-",
0-9. For example: 0.32, 2, 123, 123.456, 1.23456e-2, 12.34E3
NOTE Decimal constants without a decimal point character are treated by the
translator as 32-bit integer values. See “Data Types” on page 210.
Hexadecimal Constant:
First characters are 0x or 0X. Remaining characters are 0-9 and A-F or
a-f. No "." allowed.