Initializing variables, Sending data to the cvt and fifo – VXI VT1422A User Manual

Page 193

Advertising
background image

Creating and Running Algorithms 191

Chapter 6

Initializing Variables

Variable initialization can be performed during three distinct VT1422A
operations.

1. When algorithms are 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 an 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 an algorithm executes. By placing an assignment statement

within an 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 an algorithm first executes after an INIT command. By using

the global variable First_loop, an 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). The three algorithm functions writecvt(), writefifo(), and
writeboth() provide the means to place data into the FIFO or CVT. These
special functions may be called up to 512 times.

Writing a CVT element

The CVT provides 502 addressable elements where algorithm values can be
stored (see Figure 7-4 on page 324). 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(O124, 330); /* send output channel 24's value to CVT element 330 */

Each time an algorithm writes a value to a CVT element, the previous value
in that element is overwritten.

Important!

There is a fixed relationship between channel number and CVT element
for values from channels placed in the Scan List with ROUT:SEQ:DEF.
When mixing Scan List data acquisition with algorithm data storage, be
careful not to overwrite Scan List generated values with algorithm generated
values. See “ROUTe:SEQuence:DEFine” on page 323. for controlling CVT
entries from the analog scan list.

Advertising
This manual is related to the following products: