LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

AI and AO in a same loop

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

0 Kudos
Message 1 of 5
(2,636 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,585 Views)

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

 

0 Kudos
Message 3 of 5
(2,569 Views)

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…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(2,567 Views)

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

0 Kudos
Message 5 of 5
(2,549 Views)