I'm running LabView 6i and have encountered a bizarre discrepancy between what
*I* think should be the "number of updates" parameter of the DIO Start VI and
the number of elements I seem to have to have in the "digital data" parameter
of the DIO Write VI. Here's what the help has to say on both:
"Digital Data is a 1D array containing digital output data. Each element in
this array is an 8-bit unsigned integer that represents a single port�s data.
The total number of elements in this array equals the number of ports in the
group multiplied by the number of updates to write. For example, if your group
contains two ports, then elements 0 and 1 contain the data for the first
update."
"Number of Scans/Updates tells LabVIEW how much memory to allocate for the
buffer. If the group direction is input, a single read from each port in the
group is a scan. If the direction is output, a single write to all ports in
the group is an update. The size of a scan or update in bytes is equal to the
number of ports in the group.
Macintosh If you are using NB-DMA-8-G or NB-DMA2800, the buffer size
cannot be greater than 2^24- 1, which is 16,777,215 bytes.
The default input for # of scans/updates is -1, which means LabVIEW leaves the
current setting for # of scans/updates unchanged. The default setting for # of
scans/updates is 1000."
I have a 6533 DIO board (PCI-DIO32HS) which allows for 8, 16, or 32-bit
transfers (1, 2, or 4 ports). So, if I did a single 32-bit transfer, I would
think the "Number of Updates" should be 1, and the "Digital Data" array should
have 4 elements. However, I have discovered this not to be the case.
If I use 1 for the Number of Updates, the program errors out with a -10010
error. I found that you have to specify the Number of Updates as the number of
*byte* updates, irrespective of the width of the transfer. So in the case of a
32-bit transfer, the number of updates must be 4. Well, that I can accept.
Documentation can be poor and inaccurate. But here's where it gets really
wierd.
If I simply use 4 for the number of updates, and a 4-element data array, the
program *still* errors out. To give you the background, I build my data array
within a double nested FOR loop, the outer loop going over the number of
updates, the inner over the byte-width of the transfer. For a single 32-bit
word transfer, I would then expect to iterate over 1 outer cycle and 4 inner
cycles, to build a 4-element array. But no, Labview doesn't like that. What
I've discovered actually works is iterating over the "Number of Updates"
parameter the DIO Start routine expects, *and* over the number of bytes in the
transfer. Thus, for a single 32-bit transfer, the program must generate a
16-element array in order for the routine to work! Furthermore, the array
repeats every 4 places, so that in each block of 4 elements, you have the data
duplicated! And yet the program then does output the correct data on the
lines. It's as if the internal Labview routines actually do the following on
the Digital Data array: For transfer width W, port N, update X read array
element (W*X)+(N-1). Very strange.
Is this a bug in Labview? Or can someone explain this behavior in any other
way?
Thanks,
Alex Rast
arast@inficom.com
arast@qwest.net