LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronization for AI and AO with non-regeneration of output waveforms

Hi all,

 

I need to output several analog waveforms, while at the same time acquiring analog input, and synchronise the two. For this, I'm using a cDAQ-9178, a 9264 module for AO, and 9220 for AI.

 

I managed to this all right following this example: http://www.ni.com/example/26527/en/ (NI-DAQmx: Simultaneous AI and AO Using a Shared Clock). The problems started when I moved the waveform generation inside the main while loop to be able to modify the waveform parameters on-the-fly: now I get Error -200018 as soon as I start the VI, or Error -200284 those few times when the VI manages to run some iterations.

 

This does not happen if I omit the source of the sample clock for the two tasks, but then I lose the synchronisation between input and output.

 

Any idea of what's going on?

 

Thanks!

 

Nathan

0 Kudos
Message 1 of 13
(3,491 Views)

Can you please post the VI in LabVIEW 2011 or attach a snippet of the code?

 

The error code is explained here

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 13
(3,483 Views)

Here it is!

 

What I don't understand is why I get the errors with the clock, and not without.

0 Kudos
Message 3 of 13
(3,478 Views)

Hi all,

 

After reading some more on the topic (this in particular: https://forums.ni.com/t5/Multifunction-DAQ/poor-analog-output-performance-error-200018/m-p/1528622#M... ), I got rid of the "Wait until next ms multiple" in the while loop, and now everything runs smoothly!

 

But the input and output signals still look out of sync.

 

Any ideas?

 

0 Kudos
Message 4 of 13
(3,431 Views)

Hi nathan,

 

where do you sync your AI and AO tasks?

 

Did you look at the examples coming with LabVIEW/DAQmx on syncing tasks (like "Multi-Function-Synch AI-AO")?

Best regards,
GerdW


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

Hi GerdW,

 

I did look at that example, and used it as foundation to my VI. As far as I understand, the synchronisation depends on the shared clock (as explained here too: http://www.ni.com/white-paper/4322/en/ ).

 

This works beautifully if I generate the waveform outside the main loop, but if I put it inside, so that I can change frequency, amplitude etc. while running the test, suddenly input and output are randomly shifted.

0 Kudos
Message 6 of 13
(3,417 Views)

To any fellow newbies: the pdf attached to this example offers a good explanation of why it's not always a good idea to "slow down" the while loop via timing functions in buffered acquisition/generation: https://decibel.ni.com/content/docs/DOC-15893 .

0 Kudos
Message 7 of 13
(3,359 Views)

Hi again,

 

I've been tweaking my VI: at this point it's a hybrid between the "Multi-Function-Synch AI-AO" GerdW was mentioning, and the shared-clock approach found in the "Timing and synchronisation" white paper. Still, the input signal shows random fluctuations of the phase with respect to the output.

 

Any ideas?

0 Kudos
Message 8 of 13
(3,344 Views)

Hi nathan,

 

mind to clean up your BD before posting a picture of it? All those wires going back and forth confuse me…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 13
(3,338 Views)

That was the best I could do! Here's the VI, hope it makes things easier.

0 Kudos
Message 10 of 13
(3,333 Views)