Specifications
Algorithm Definition Algorithms are similar in nature to global definitions. Both scalars and arrays can
be defined for local use by the algorithm. If less than 256 characters, simply place
the algorithm code within string quotes:
ALG:DEF ‘alg1’,’static floata=1;if(I100>a)writecvt( I100,10);’
If the algorithm exceeds 256 characters, it will be necessary to download an
indefinite block header, the algorithm code, and terminated by a LF/EOI sequence:
ALG:DEF ‘alg2’,#0static floata=1;...;LF/EOI
Algorithms remain around and cannot be altered once defined unless a fixed size is
specified for the algorithm (see Chapter 4). Algorithms are removed from memory
only by issuing a *RST or power-ON condition.
Agilent VEE text boxes are good tools for storing the algorithm code and will be
used extensively by this manual. See the “temp1419.vee” example program in
Chapter 5 which illustrates downloading algorithms to the VT1419A.
Pre-Setting
Algorithm Variables
It may have been noticed in the examples above that a variable can be initialized to
a particular value. However, that value is a one-time initialization. Later program
execution may alter the variable and re-issuing an INIT command to re-start
program execution will NOT re-initialize that variable. Instead, any scalar or array
can be altered using SCPI commands prior to issuing the INIT command or the
intrinsic variable First_loop can be relied upon to conditionally preset variables
after receiving the INIT command. First_loop is a variable that is preset to
non-zero due to the execution of the INIT command. With the occurrence of the
first scan trigger and when algorithms execute for the first time, First_loop’s value
will be non-zero. Subsequent triggers will find this variable cleared. Here’s an
example of how First_loop can be used:
ALG:DEF ‘alg1’,#0static float a,b,c, start, some_array[ 4 ]; if ( First_loop )
{a=1;b=2;c=3;}**LF/EOI
To pre-set variables under program control before issuing the INIT command, the
ALG:SCALAR and ALG:ARRAY commands can be used. Assume the example
algorithm above has already been defined. To preset the scalar start and the array
some_array, the following commands can be used:
ALG:SCAL ‘alg1’,’start’,1.2345
ALG:ARR ‘alg1’,’some_array’,#232..........LF/EOI
ALG:UPD
The ALG:SCAL command designates the name of the algorithm of where to find
the local variable start and assigns that variable the value of 1.2345. Likewise, the
ALG:ARRAY command designates the name of the algorithm, the name of the
local array and a definite length block for assigning the four real number values. As
can be seen, the scalar assignment uses ASCII and the array assignment uses binary.
The later makes for a much faster transfer, especially for large arrays. The format
used is IEEE-754 8-byte binary real numbers. The header is #232 which states “the
next 2 bytes are to be used to specify how many bytes are coming.” In this case,
32 bytes represent the four, 8-byte elements of the array. A 100 element array
would have a header of #3800. To pre-initialize a global scalar or array, the word
‘globals’ must be used instead of the algorithm name. The name simply specifies
the memory space of where to find those elements.
Programming the VT1419A Multifunction
Plus
Defining C Language Algorithms
74 Chapter 3
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com










