LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform chart slow to read samples AIs when sending AOs

Hi all,

 

I am using labview to sample AI signals and send AO signals sampling at 4k with 400 samples to read... The AOs are triggered using buttons on the frontal (E-stim or M-Stim).. When the E-stim button is pushed it will generate a square-wave signal with the freq and pulse characteristics as selected on frontal panel (default is 1 pulse at 50Hz)... These are pulses are used to control a muscle stimulator... So the idea is to be able to send whatever signal I want and have the stimulator deliver that same stimulus to the muscle (e.g. 10 pulses at 50Hz, or 5 pulses at 100Hz, etc etc).. To check the timing of this, I connected the AO to the "trigger in" on the stimulator and the "trigger out" on the stimulator to an AI channel... The pulses are coming through from the stimulator as expected...

 

However, when I send the AO pulses labview seems to "freeze" or "suspend" until all output pulses are sent... This is very apparent with a high number of pulses (e.g. 10 pulses at 50Hz)... That is, the waveform chart freezes/stops scrolling until all AO signals are sent, then the chart updates all the pulses in one hit and continuous displaying data; rathe than have each pulse displayed individually...Why concern is that AI during the AO phase may be losted ot not sampled properly...

 

Can anyone provide me with an explanation for this behaviour? I am using a LV2010SP1 and a USB-6218 BNC multifuction DAQ.

 

Thanks!

Jack

 

Download All
0 Kudos
Message 1 of 5
(2,662 Views)

You need to move multiple loops outside the gaint loop in the program. Until everything completes it will wait until it is done.

 

At least this is my quick overview sees.

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

Hello Jack, 

 

Reviewed the code.

Remember The way labview executes code, Labview executes code by flow of information meaning that it is going to wait untill the neccesary items are ready before executing the next part of the code.

For example If we want to make a simple add function for "x" and "y" labview is going to wait untill both inputs are ready for operation before operating and outputing  "z" as a result.

It does it the same way everytime. I took the time and rearranged the code so we can understand it better, The execution happens from left to right, from top to bottom.

If we refer to the image, the arrows show us the flow of information of the VI, The DAQ assitant, the filtering of the signal and the Triggering is done before you actually output data through device1 analog output.

The code is expected to work that way cause it waits untill done acquiring with the DAQ asistant to start generating an output.

 

I can think of different options,

 

-You can modify this VI so that the output takes place regardless of the input data

-Having two different vis where you can set the read and write at different rates, using a functional global variable.

-Using a producer/consumer architecture.

 

This is an example that I think might be useful.

 

Using Producer/Consumer Architecture for DAQmx Read and Write to File

 

Hope this was helpful,

 

Luis Martinez.

Applications Engineer.

National Instruments.

 


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

Thank you !!

 

That helps a lot.

0 Kudos
Message 4 of 5
(2,629 Views)

Thanks Joseph... Moved the loops; now working much better...

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