VXi VT1422A 사용자 설명서

다운로드
페이지 529
212 Creating and Running Algorithms  
Single-dimensioned arrays of type float with a maximum of 
1024 elements:
Declaration
static float array_var [3];
Use
array_var [0] = 0.1;
array_var [1] = 1.2;
array_var [2] = 2.34;
array_var [3] = 5;
Storage
Arrays are "double buffered." This means that when an array is
declared, twice the space required for the array is allocated, plus
one more word as a buffer pointer. The memory required is:
words of memory = (8 * num_elements) + 1
This double buffered arrangement allows the ALG:ARRAY
command to download all elements of the array into the "B" buffer
while an algorithm is accessing values from the "A" buffer. Then
an ALG:UPDATE command will cause the buffer pointer word to
point to the newly loaded buffer between algorithm executions.
Bitfield Access
The VT1422A implements bitfield syntax that allows individual bit values 
to be manipulated within a variable. This syntax is similar to what would be 
done in 'C', but doesn't require a structure declaration. Bitfield syntax is 
supported only for the lower 16 bits (bits 0-15) of simple (scalar) variables 
and channel identifiers.
Use
if(word_var.B0 || word_var.B3)
/* if either bit 0 or bit 3 true ... */
word_var.B15 = 1;
/* set bit 15                              */
 NOTES
1. It is not necessary to declare a bitfield structure in order to use it. In 
the Algorithm Language the bitfield structure is assumed to be 
applicable to any simple variable including channel identifiers.
2. Unlike 'C', the Algorithm Language allows for both bit access and 
"whole" access to the same variable. Example:
static float my_word_var;
my_word_var = 255
/* set bits 0 through 7
*/
my_word_var.B3 = 0
/* clear bit 3 
*/