LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

AO write problems

When writing to an AO channel with the Traditional driver, I was able to go from writing multiple samples, to writing one sample, by first clearing the AO (AO Clear.vi), then passing the Task ID to AO Single Update.vi along with a value, as long as that value is passed through the "build array" tool.
 
It seems to me however, that i cannot accomplish this with DAQmx. With DAQmx, i have no problems, so long as i am writing MORE samples than i had previously written (i.e. i write a 0, then i write 0-0, then i write 0-0-0-1-1-1). However, if i try to write LESS samples, i get an error (i.e. 0-0-0-1, then just a 0....ERROR). The only way around this (that I've found) is to Clear the task completely, and then re-create it. Am i missing something, or is this really the only way of accomplishing going from writing an array of data to an AO to writing a single value to that same AO channel?
 
Thanks in advance.
 
David
0 Kudos
Message 1 of 3
(2,524 Views)
wow. thanks for the help fellas.
0 Kudos
Message 2 of 3
(2,506 Views)

The input to DAQmx Write, if you're using multiple samples, is an array. So, each time you write more data than the last time, the array auto scales to the larger size. But, it doesn't work the other way.

If you know how many samples you're sending at a time, and the next set of samples is less than the previous, use Delete From Array to delete the non-existant rows from the array prior to sending it into DAQmx Write.

Richard






0 Kudos
Message 3 of 3
(2,495 Views)