Specifications
The Algorithm Execution Environment
This section describes the execution environment that the VT1419A provides for
algorithms. Here the relationship between an algorithm and the main() function that
calls it is described.
The Main Function All ‘C’ language programs consist of one or more functions. A ‘C’ program must
have a function called main(). In the VT1419A, the main() function is usually
generated automatically by the driver when the INIT command is executed. The
main() function executes each time the module is triggered and controls execution
of an algorithm's functions. See Figure 4-1 for a partial listing of main().
How User
Algorithms Fit In
When the module is INITiated, a set of control variables and a function calling
sequence is created for all algorithms defined. The value of variable “State_n” is set
with the ALGorithm:STATe command and determines whether the algorithm will
be called. The value of “Ratio_n” is set with the ALGorithm:SCAN:RATio
command and determines how often the algorithm will be called (relative to trigger
events).
Since the function-calling interface to an algorithm is fixed in the main() function,
the “header” of an algorithm function is also pre-defined. This means that, unlike
standard ‘C’ language programming, an algorithm program (a function) need not
(must not) include the function declaration header, opening brace “{” and closing
brace “}.” Simply supply the “body” of the function; the VT1419A’s driver
supplies the rest.
Think of the program space in the VT1419A in the form of a source file with any
global variables first, then the main() function followed by as many algorithms as
have been defined. Of course, what is really contained in the VT1419A’s algorithm
memory are executable codes that have been translated from the downloaded source
code. While not an exact representation of the algorithm execution environment,
Figure 4-1 shows the relationship between a normal ‘C’ program and two
VT1419A algorithms.
The Algorithm Language and Environment
The Algorithm Execution Environment
108 Chapter 4
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com










