LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sample by sample analysis behaves differently at different DAQ hardware

Hello,

I have already posted a similar message in the forum before but it is a bit different.

What I am trying to do is to acquire a voltage signal and analyze it sample by sample. I am doing that through the acquire N samples setting of the DAQ card and then use a for loop whose number of iterations is equal to the size of the group.

When I use the card A there is a limit of the minimum size of data that I can use. Bellow that limit I receive an error message saying that the data that I am trying to read is not available and that I have to increase the size of the group to avoid that. If I increase the size of the group then the signal that I am processing is significantly out of date.

When I use a faster DAQ card and at the same sampling rates I can reduce the size of the group and hence get a more up to date analysis.  But the algorithm now runs remarkably slow which also delays the processing of my data.

Why is this happening and is there any way that allows data acquisition sample by sample since my algorithm only works this way.

DAQ Card A: DAQCard-6024E

DAQ Card B:  NI 9206

I have also attached an image with the samples extraction loop

Many thanks in advance.

0 Kudos
Message 1 of 6
(2,957 Views)
Hello. First of all, do you configure the DAQ in the "Measurement and Automation Explorer"? As I see in the image you sent, you're using the DAQ assistant for your program. I suggest you configure a Task in the M and A explorer, specifying the frequency and rate you require. Then, in your code, use the "DAQmx Read" function to acquire the data, calling the task you previously defined. You may also want to use the "Clear Task Function".
0 Kudos
Message 2 of 6
(2,935 Views)
Hi kalitexnis,

It's tricky to see what you're doing in the DAQ assistant block, so it might be useful for you to post your code for us to have a look at. In a similar vein to Ali84's response, I've attached an example where the task is generated programmatically in LabVIEW. It helps you to see what's going on with all the parameters, and you should be able to perform this acquisition on pretty much any DAQ device.

Give the example a try and let me know if you have trouble. Alternatively, post your code for me to have a look at and I'll see what's going wrong. Essentially, you should be able to acquire any number of samples at any rate your hardware supports without difficulty.

Post back with any questions or difficulties!

Best regards,
Tom

Applications Engineering, NI UK
0 Kudos
Message 3 of 6
(2,901 Views)

Many thanks for your reply your help is much appreciated.

 

I simplified my problem for a more clear description. As you mentioned I should be able to acquire any amount of samples at any given rate as soon as the hardware permits it.

 

When I am acquiring data at 1000 samples/sec at continuous acquisition mode and one sample for the buffer everything works fine. 

 

When I change that data acquisition rate to 100000 samples/sec, then I received an error which I have attached. (See error and data asq is stopped files)

 

Regarding your reply if I plot the sample by sample data then the signal looks significantly distorted. This is probably to some kind of delay.(see example2.vi)

 

My problem could be solved if I could increase the sampling rate without receiving the error. I am suspecting that the problem arises with the speed of the RAM. Would it be better if I ran the code in a real time environment?

 

Many thanks once again for your time and your support

Download All
0 Kudos
Message 4 of 6
(2,878 Views)
The problem is you are only reading 1 sample at a time.  At high enough data acquisition rates, the loop can't iterate fast enough to keep up with the data that's coming in.  A Windows PC is only so fast.  Try reading more samples at once.   For 100,000 samples/sec, you would probably want to read at least 10,000 samples at a time.
0 Kudos
Message 5 of 6
(2,861 Views)
Hi Kalitexnis,

Were you able to get your data sampling as you want? Let us know if you're still having trouble. I altered the last program you attached so that it should now do what I think you want it to do. Bear in mind that sampling data at 100,000 Hz and pulling it out sample-by-sample simply isn't possible, that's why I'm pulling data out 1000 samples at a time in the code.

Post back if you have questions or difficulties with this!

Regards,
Tom

Applications Engineering, NI UK
0 Kudos
Message 6 of 6
(2,831 Views)