11-19-2017 07:22 AM
Hi everybody,
Here i have created a vi for loading frame system using usb 6211, the vi is working properly but i need to do a AI and AO task in a single loop, i have attached my vi, so that you guys can give me a suggestion.
Thank you
regards
paul
11-20-2017 01:18 AM
Hi Paul,
i need to do a AI and AO task in a single loop
Why?
What's wrong with separate loops for separate tasks? It even helps to modularize code…
For me the bigger problem are all those array-to-cluster conversions. And please try to use autoindexing loops, they will greatly help for those scaling subVIs…
11-20-2017 05:29 AM
Hi Gerdw,
First of all thanks for the reply, ihave attached you a code that has two statemachine two control AI & AO seperately, i get response when i start the acquisition but when i press stop button it shows error message, can you suggest me which i can go to get the right source?
Thanks in advance,
Regards,
Paul
11-20-2017 05:41 AM
Hi Paul,
i get response when i start the acquisition but when i press stop button it shows error message
- Which error do you get?
- There is no error handling at all in your VI!
- There is no timing at all in your loops! (Apart from queuing commands to the consumer loop the producer loop is running as fast as it can…)
11-20-2017 08:35 AM
Where is the DAQmx Timing function? Or is this "built-in" to the Channel Constant by MAX, rather than (more safely) specified in your code?
[I rarely do "single-sample I/O", so am acutely aware that the hardware clocks of my DAQ devices are typically far more accurate and precise than Windows, so I take pains to set them appropriately in my DAQmx code. I must confess that I don't know how "single sample" acquisition is timed -- I should probably "do an experiment" and find out ...]
...and the answer is -- single samples (at least of the NI USB-6009) do not use the device's clock. I just did 10,000 samples with the device set (by MAX) to do on-demand samples at 1KHz, then I used code similar to the OP's where I defined the Channel, started a 1-Channel, 1-Sample AI task, and 10,000 samples in a For loop took 4.37 seconds, considerably faster than 10,000/1000 = 10 seconds. So now I know ...
Bob Schor