Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the most efficient way of taking a finite number of samples from different channels at each analog trigger (1ms) with the DAQmx

Hi !
I use a PXI-1031 and a BNC-2110 for my data acquisition. My problem is fairly simple... I want to take 5 samples
at a repetition rate of 125kHz from four different channels each time I receive an analog trigger that is set at ~1kHz. My VI runs ok but it skips one trigger out of two and it makes a big difference in a 4 hour experiment. I tried plenty of different configurations and it still saturates at 500Hz. The only way that worked partially was taking continuous samples at 125kHz and triggering the reading but the buffer quickly overflows. I really don't understand why taking a finite number of samples would take more time then continuously. Any ideas?
On my attached VI, I go from continous to finite mode by changing the variable on the DAQmx Timing VI.
Thanks for any help!
Ludovic.

0 Kudos
Message 1 of 4
(3,599 Views)
Hello Ludovic,

It sounds to me like what you are trying to program is a retriggerable finite analog input task.  This is possible if you first set up a task to generate a retriggerable finite pulse train (using counters) and then use this signal as your analog input clock source.

The following example demonstrates how to do this for analog output, but it could be easily modified for analog input:

NI-DAQmx: Retriggerable Analog Output

I hope this helps!  Let me know if you have any questions about what I've just described.

Best regards,
0 Kudos
Message 2 of 4
(3,578 Views)
Thank you for your answer Jarrold!

I looked at the retriggerable VI but I really don't think it is the source of my problem. From what I experienced, it seems to be a problem with the finite mode option. I modified my VI so that it clears the DAQmx buffer when I'm in the continuous mode after I take 5 samples from each channel and it works at a repetition rate of 1kHz as long as I wish!! I just don't think it's a very elegant way of doing it.... If you have other suggestions, I would be happy to try them.

Ludovic.
0 Kudos
Message 3 of 4
(3,560 Views)
Hello Lodovic,

The way I understand your application, you are trying to acquire a finite number of samples from each channel when a trigger pulse comes in, then repeat this for each trigger pulse.  In other words, you want to program a retriggerable finite analog acquisition.  This is exactly what the example I mentioned does.  It generates a retriggerable finite pulse train, then uses this as the sample clock for a continuous analog input task. 

Don't get confused by the fact that the analog input task is set for continuous.  This simply ensures that the task continues to run until the user hits the stop button.  There are still a finite number of samples being acquired on each channel per trigger.  This is due to the fact that the sample clock is coming from a retriggerable finite pulse train.

I'm not sure how your current program is set up, but you should not have to explicitly clear the memory buffer assigned by DAQmx.  Let me know if you still have any questions about this. 

Best regards,
0 Kudos
Message 4 of 4
(3,555 Views)