Specifications

static float scalar_var;
static float array_var[4];
/* assign constants to variables on first pass only */
if ( First_loop )
{
scalar_var = 22.3;
array_var[0] = 0;
array_var[1] = 0;
array_var[2] = 1.2;
array_var[3] = 4;
}
Initializing Variables Variable initialization can be performed during three distinct VT1419A operations.
1. When an algorithm is defined with the ALG:DEFINE command. A
declaration initialization statement is a command to the driver’s translator
function and doesn’t create an executable statement. The value assigned
during algorithm definition is not re-assigned when the algorithm is run with
the INIT command. Example statement:
static float my_variable = 22.95;/* tells translator to allocate space for this */
/* variable and initialize it to 22.95 */
2. Each time the algorithm executes. By placing an assignment statement
within the algorithm. This will be executed each time the algorithm is
executed. Example statement.
my_variable = 22.95; /* reset variable to 22.95 every pass */
3. When the algorithm first executes after an INIT command. By using the
global variable First_loop, the algorithm can distinguish the first execution
since an INIT command was sent. Example statement:
if( First_loop ) my_variable = 22.95; /* reset variable only when INIT starts alg */
Sending Data to the
CVT and FIFO
The Current Value Table (CVT) and FIFO data buffer provide communication from
an algorithm to the application program (running in the VXIbus controller).
Writing a CVT element
The CVT provides 502 addressable elements where algorithm values can be stored.
To send a value to a CVT element, execute the intrinsic Algorithm Language
statement writecvt(<expression>,<cvt_element>), where <cvt_element> can take
the value 10 through 511. The following is an example algorithm statement:
writecvt(O136, 330); /* send output channel 36’s value to CVT element 330 */
Each time the algorithm writes a value to a CVT element the previous value in that
element is overwritten.
The Algorithm Language and Environment
Accessing the VT1419A’s Resources
112 Chapter 4
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com