Bitfield Access - HP VXI 75000 C Series User's And Scpi Programming Manual

Algorithmic closed loop controller
Table of Contents

Advertisement

Bitfield Access

NOTES
Declaration Initialization
142 Algorithm Language Reference
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 you declare
an array, 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 your 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.
The HP E1415 implements bitfield syntax that allows you to manipulate
individual bit values 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;
1. You don't have 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 you both bit access and
"whole" access to the same variable. Example:
static float my_word_var;
my_word_var = 255
my_word_var.B3 = 0
You may only initialize simple variables (not array members) in the
declaration statement:
static float my_var = 2;
/* set bit 15
/* set bits 0 through 7
/* clear bit 3
*/
*/
*/
Chapter 5

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vxi e1415a

Table of Contents