08-05-2009 08:06 AM
Hello everybody.
I am new to this forum, though i have some experience using labview - mostly in image processing.
Now i am trying to process data acquired from a DAQ card.
I would like to know if it is ok to use loop execution rate with the same frequency as is the sampling rate for the DAQ?
Furthermore, how can i get discrete values for an analog continous signal? For example: sine signal, from which i would like to get 2000 samples/second, so if i acquire data for 10 seconds, i would get 20000 values?
I am sorry if this has been answered, i searched but did not find it.
Best regards,
Klemen P.
08-05-2009 09:10 AM
Addon to the previous post:
When i set the loop execution rate and use shift registers to specify the speed of the loop (the difference between the next and the previous execution), why doesn't the indicator ("actual loop frequency") show the same number as the set execution rate ("loop frequency"), when the desired frequencies go higher?See the picture below.
thank you
08-06-2009 02:20 AM
Hi klemen,
To answer your questions properly, maybe you could give more general view on what you try to accomplish.
If you need to acquire data and do some processing with them, I would preffer to use much slower execution speed of your program than configured sampling rate on your device. You can all the time process data afterwards. Thus you get much better performacne and much lower load for your computer.
I don't know what card you have, but I assume you have DSA card. Those devices are supposed to measure dynamic signals, usually with sampling rates of couple of kS/s. It can be beyond what you can achieve with software timing (and I meen you don't have to be able to read from device as frequently).
You can try the simplest way:
- open Example Finder and find example for your DAQ device named similar to "hardware timed finite sample acuisition"
(I suppose Hardware Input and Output -> DAQmx -> Analog Measurement -> Voltage (for example) -> Acq&Graph Voltage-Int Clk.vi)
- Notice that DAQmx read is configured to measure 1D array of Waveforms (multiple channels multiple samples).
- to process measured data value by value, connect them to For Loop and allow auto index (by default is enabled, see help).
- in each iteration of For Loop, you have i(th) measured element.
Let me know if you have further questions.
Regards,
Martin
08-06-2009 02:32 AM
Hi lemen,
I hope I'm answering what you asked
From the previous post, the code could look similar to this one:
Regards,
Martin
08-06-2009 03:44 AM
Hi klemen,
To your sencond question.
First of all, I'm not clear on what you try to accomplish, but It is expected that the number you see in "Actual loop frequencyHz" will not match "loop frequency Hz". Moreover,this post is better suitable for general LabVIEW forum.
Before you read further, think of data you try to average! What do you get from inner loop?
Keep in mind that LabVIEW is dataflow language. Means, you can't get data (results) from function, before the function finishes execution. In this example, you try to average time from multiple iterations of inner loop. However, the loop will execute all the time different number of iterations. This results in variable time necessary to get data out of iner loop. It means, the difference between 2 iterations of external loop varies.
Median PtByPt VI averages last 10 values it got - in our case times to execute iner loop - which varies a lot.
The example you could use as inspiration can look as follow:
Hope it helps.
Regards,
Martin
08-06-2009 03:00 PM
Thank you very much for your answers!I will look into them thoroughly.
But i will have to leave the while loop, because i want real-time data display, which stores in a buffer and then i can go through the data, when i end a set of measurements - to analyze the date and to process it.
Thank you again, it was very helpful!
Best regards,
Klemen P.
08-07-2009 01:56 AM
Hi klemen,
If you need just to display data, than you should keep in mind that person will not recognize differences in somethink like 100-200 ms intervals. Therefore, I still suggest you to use post processing, but for smaller amount of data - acquired during 100-200ms.
Thus you will be able to see very recent data, without sacrificingprogram response and CPU load.
Regards,
Martin