LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sampling DAQ mx

hello

i was doing signal acquisition.

as what i did previously, i use DAQ assistant for finite sample acquisition.i have 2 channel for analog voltage. setting the number of sample to be 1000, and sampling rate 1000.( Am i correct to think that the buffer size is automatically set to 2000?), i will have the 'graph' showing that the signal has 2 peak, as it has enough time to read from the buffer.(the signal is having 2 peaks which the distance between the peak is close enough). it has no problem.
however, again if the sample number is 1000, and sampling rate is 1000. the signal with 4 peaks(the 2nd peak and 3 rd peak is far enough), will be read from the graph showing that it is 2 signal with 2 peak.(i reckon it is the problem of setting the sample to read.Am i correct?), which means that the data is not having enough time to read from buffer.

If i set sample number to 3000, sampling rate is 1000, i can notice that the signal(signal with 2 peak) will be merged with the next signal which has 2 peaks, making up of total 4 peaks in the graph. then it will be detected as 4 peaks(it is not correct for my requirement of calculation). In contrary,  it is ideal for the single signal which has 4 peaks. Overall, i can find that the ratio of number sample to sampling rate is determining how long the data is read from the buffer,and this ratio is making other vi in the same while loop getting slower.Am i correct to assume this?if so, how i counter this problem?

when i open the front panel of daq assistant vi, i think of putting the DAQmx configure input buffer.vi before start task DAQmx Read.vi to determine the buffer size. is it working if the buffer size set to 6000?will my problem be settled?also, what about the timeout in DAQmx read?is it related to the buffer size also?

it seems that i maybe confusing u.
i will explain in simpler way if u need me to do so

thanks
regards

0 Kudos
Message 1 of 2
(2,395 Views)

Hello Heang,

I am not sure what you are asking.  Perhaps an explanation of the signal you wish to measure, how long you would like to measure it for and what you expect to see on your graph.  Here are a few things to consider:

DAQmx automatically sets the buffer size based upon the rate of the task and the number of samples to read. If you have a finite task for two channels, each acquiring 1000 samples your buffer will be set to 1000 x 2 = 2000 samples.  Finite tasks will set the buffer size exactly equal to the number of total samples that will be acquired. The algorithm for automatically setting a buffer size on a continuous task is a little more complex.  Details can be found in the LabVIEW Help files under the title "How is Buffer Size Determined". If you wish to use a different buffer size you can use a DAQmx Buffer Property Node.

The default for timeout is 10 seconds.  You can however choose different timeout values, including -1 which will disable the timeout altogether.  The values that you mention should not cause any timeout to occur.  The setting of 1000 samples at 1000 Hz will sample 1 second of data on each of the specified channels.  If you specify 3000 samples at 1000 Hz then 3 seconds of data will be returned for each channel. Also note that only the data which is actually being collected will be transferred into the buffer.  If you specify 1000 finite samples, the buffer will only receive the 1000 samples and only the 1000 samples would be available to be read.

Please further explain what you mean by peaks.  Are you for example reading in two periods of a sine wave?  Are you trying to use a function to measure the peaks?  If you are trying to run independent code (separate from your acquisition) you can run it in another loop.  A loop will wait until all of its functions have completed before executing for a second time.  Therefore if you read 1000 samples (at 1000 Hz) in your DAQmx Read the loop will take at least 1 second to execute.  Therefore all code in that loop will run a maximum of once per second. The two ways to change this behavior is to either take the code which must run faster and place it in a separate loop or to specify a smaller number for the DAQmx Read.  You could for example read 100 samples at a time and run the loop 10 times to get the 1 second of data.

Hope this helps,

Jennifer O.
Applications Engineer
National Instruments

0 Kudos
Message 2 of 2
(2,359 Views)