Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Proper Sampling with LabView DAQ Assistant

I am new to LabView and the whole world of data acquisition.  I am attempting to read voltages from a pressure transducer.  The transducer operates on 5 VDC.  The output is approx. between  -.1 VDC and .1 VDC.  I am using a SCB-68 junction box to connect the tranducer outputs to the DAQ board (PCI-MIO-16E-4).  I am attempting to use the DAQ assistant in LabView 7 to read these voltages.  I have set the voltage input values to +/- 5V and have it set for continuous measurement.  I also have the reference set to NRSE which as I understand means that the negative output from the transducer must be connected to the AISENSE channel on the junction box and the positive lead connected to an appropriate channel.
 
Here's my problem:
The useful transducer output frequency is 0.2 MHz.  I am continually getting errors in the DAQ assistant saying the samples were "previously available but have since been over written".  It then says that increasing the buffer size or increasing the sampling rate may fix this problem.  I have played around with the sampling frequency and the number of samples but I still get this error every time.  How do I increase the buffer size in the DAQ assistant?  Apparently, just increasing the sampling frequency does nothing. 
 
I'm stumped......
 
Any suggestions would be greatly appreciated.
 
Thanks,
Rich
0 Kudos
Message 1 of 7
(5,044 Views)

What is your buffer size and sampling rate? How many samples are you reading from the buffer each loop iteration? Not only do you need to make sure your buffer is large enough to hold all your samples, you also need to make sure that your program is getting the data from the buffer quickly enough so that the buffer is not filled. Increasing your sampling frequency. will increase the number of samples you gather, which will fill your buffer quicker. Try Increasing the number of sampes you read each loop by using 'samples to read' option.

Hope this helps

0 Kudos
Message 2 of 7
(5,031 Views)

I have tried many combinations of sampling frequency and 'number of samples'.  The only combo that seems to work is using 10 Hz and 1 sample.  This doesn't give an accurate depiction of the signal though.  I would like to sample close to the useful frequency range which is      0.2 MHz.  That is when I get the errors.  I have tried increasing the number of samples but I still get those same errors.  I don't know how to increase the buffer size.  Do you know if the buffer can be increased using the DAQ Assistant?  The DAQ assistant seems to be a very simple built in feature of LabView that may not have that option.

In response to your comment:

I thought that increasing the sampling freq.  would "read the samples out of the buffer" quicker in order to make room for more incoming samples.  Is that not correct?

Thanks for your input and any other tips you might have.

0 Kudos
Message 3 of 7
(5,023 Views)
The daq assistant uses daqmx, and i think daqmx automatically configures your buffer size depending on your sampling rate, so i dont think this option is available.
I configured a single channel AI read with the daq assistant using continous mode, 10000 samples to read, 200kHz sampling rate, in a while loop with a 10ms delay and had no problems reading data (well, at least for the few minutes the VI ran). If you right click on the daqmx assistant, and select 'Open Front Panel', you can see how the daq assistant configures a AI read task.
What i would recommend is to take a look at one of the daqmx shipped examples that come with LV, specifically 'ContAqc&Chart Samples - IntClk.vi'. Search for 'analog' in the example finder.
I have used this example to aquire analog data from one channel at 200kHz without any problems on a PCI-6221 card. I dont think you should have any problems either as the max single channel sampling rate for your card i think is about 500kHz. Make sure that you are reading enough samples every loop (by changing the 'samples to read' constant).
Play around with this example and let me know if you have any problems.
0 Kudos
Message 4 of 7
(5,011 Views)

Thanks for the info!  I'll play around with it some more and let you know how it goes.

 

0 Kudos
Message 5 of 7
(5,003 Views)

Well, I tried using a 10ms delay with the daq assistant as well as the example you suggested.  I am still getting the same errors no matter how I change around the parameters.  I'm beginning to think that there is possibly something wrong with the transducers.  I might try to get in touch with a local NI representative.  Thanks for all your help!  Even though my problem isn't fixed I have still learned alot so far. 

Thanks Again.

0 Kudos
Message 6 of 7
(5,000 Views)
Hello Rich,

The error you are receiving occurs independently of whether or not the transducer is operating properly or not.  Also, you and DavidT are both correct in how the buffering is handled.  The DAQmx driver will automatically configure the size of the buffer based on the sample rate and the number of sample to read.  The DAQ Assistant is mainly used when you want to setup a simple acquisition and are not worried about doing any sort of advanced configuration.  You can explictly configure the size of the buffer using the DAQmx Configure Input Buffer VI, but you will have to use the DAQmx VIs instead of the DAQ Assistant.

In regards to your question: "I thought that increasing the sampling freq.  would "read the samples out of the buffer" quicker in order to make room for more incoming samples.  Is that not correct?"
The sampling rate determines the frequency at which analog signals will be converted to digital values.  This will directly affect how fast your software buffer will be filled with data, but will not affect how fast they will be read from the buffer.  The rate at which the samples are read from the software buffer will be determined by how fast your while loop is executing.  There is some amount of overhead associated with every iteration of the while loop and every execution of a DAQmx Read (the function that actually goes and reads the data from the software buffer).  Therefore, reducing the number of samples to read does not necessarily mean that you will be reading samples out of the buffer any faster.

I would highly suggest that you take DavidT's advice and open one of the LabVIEW shipping examples.  You can open the NI Example Finder by going to the menu bar of a VI and selecting Help >> Find Examples...  You can browse through the folders to find:  Hardware Input and Output >> DAQmx >> Analog Measurements >> Voltage >> Cont Acq&Graph Voltage Int - Clk.

I hope this helps!  If you have any other questions, please feel free to ask them.
Eric
DE For Life!
0 Kudos
Message 7 of 7
(4,979 Views)