Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Sample rate vs. Read rate

I am using a DAQCard-6036E with LabView (7.0).
 
I wish to do continuous acquisition with hardware timed sampling.  Based on a sample, I am using AI_Config and AI_Start to setup the acquisition, and AI_Read to read the sample.  I want to get 1 sample at a time from multiple channels.  The curious thing is that when my sample rate * number of channels exceeds 1000S/s, I will always get a scan backlog of multiples of 42.  For example, I want to sample 12 channels at 250 Hz.  On the first loop of AI_Read, I will have a backlog of 42.  I can loop on the AI_Read until the backlog is at 0.  The next call to AI_Read will have a short delay, and I am back to a backlog of 42 and so on.  If I keep sample rate * number of channels below 1000 (for example, scan at 80 Hz), I will always have a scan backlog of 0, and can essentially process my samples realtime.  If I read more than one scan at a time in AI_Read, it does not affect the backlog (it just reduces it by a multiple of the scan read each loop instead of 1).
 
Given the circumstances, I could understand if the backlog was occasionally 1 or 2 or 3, but it is either 0 or multiples of 42.  Why is this?  Does the DAQCard use a different transfer mechanism if the number of samples exceeds the 1000S/s threshold?  I understand the DAQCard doesn't support DMA, so what is the difference?  I basically need to do software triggering, but with a 42 sample lag, I am looking at 164mS delay from the data read until it is processed.  This seems ridiculous given the 200 KS/s capability of the DAQCad-6036E and the processing speed of modern PCs.
 
What is causing this?  What are my options for "realtime" processing?  Could NiDAQmx help?
 
Thanks,
Darrin
 
 
0 Kudos
Message 1 of 3
(3,408 Views)

Dear Darrin,

I strongly recommend upgrading your driver to DAQmx. There is an example in the Example Finder (Help menu>>Find Examples) called Cont Acq&Graph Voltage-Int Clk.vi (Browse Hardware Input and Output>>DAQmx>>Analog Measurements>>Voltage) that performs a continuous acquisition with hardware timed sampling.

If you get a DMA error add a property node right after DAQmx Create Channel. To add the property, node right click on the block diagram and select NI Measurements>>DAQmx - Data Acquisition>>DAQmx Channel Property Node. Click on the property and select Analog Input>>General Properties>>Advanced>>Data Transfer and Memory>> Data Transfer Mechanism. Have a great day!

Sincerely,

Marni S.

 
0 Kudos
Message 2 of 3
(3,385 Views)

I think that what's happening is at 1 kS/s boundary, the driver is automatically switching from a FIFO request condition of FIFO not empty to FIFO half full.  Since the 6036 has a 1024 sample FIFO, data is either published to the host buffer every sample or every 512 samples (in this case I'm calling a sample one point from one channel).  I think there is a way to override this behavior, but I don't have the Traditional DAQ driver installed in order to verify for certain.  Try looking at the Set DAQ Device Info function for an option to do this.  The tradeoff you're making is CPU utilization for responsiveness.  When setting the request condition to not empty, you're generating an interrupt to the system with each sample acquired.  At rates around 1 kS/s or less, this is probably fine, but as your sample rate increases, you'll definitely start to see the hit on your CPU.  At certain "sweet" spots, you may even lock up your computer since all your computer has time for is servicing the FIFO request interrupt.

If you can't find a way around this in Traditional DAQ, I know DAQmx will definitely allow you to customize this behavior.  It also does a better job of preventing your computer from locking up if you end up generating more interrupts per second than your system can handle.

0 Kudos
Message 3 of 3
(3,358 Views)