Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Record data too slow

Hi, everyone

 

I am having a problem with slow data recording. 

After I initialize all the instruments, I noticed that the while loop ran much slower that it should be(numeric indicator of iteration

The speed for recording data is roughly 0.2s/datapoint which is too slow for me. The preferable speed would be 0.002s/datapoint or even faster. I am using PCI 6224 DAQ Card(16-Bit, 250 kS/s, 32 Analog Inputs). I am also record data from the nanometer which employed  the GPIB read and write function. I would not think it will slow the loop significantly.

I am not sure why this happens, could someone have a look at my program and help me out? 

 

Thank you.

0 Kudos
Message 1 of 2
(3,799 Views)

Hi SunHarvard,

 

The amount of code that can be executed in a given unit of time depends on a number of factors including the speed of your processor. If you have too much code in your while loop, the rate of the iterations will be dependent on the amount of time taken by your processor to execute all the code within the while loop.

 

The reason your while loop is iterating solwly is because you are configuring your instrumentation, reading data and processing the data all in your while loop.

 

A good approach to your application would be to consider a multi-loop design pattern like the producer consumer design pattern which can be found here:

http://www.ni.com/white-paper/3023/en/

 

In your producer loop, you can have different states to initialise, configure, read and shut down your instrumentation. You can use a queue to pass data to your consumer loop and then process the data in the consumer loop. Thiswill give you much faster rates of data acquisiotion.

 

Thanks and Regards,

Thanks and Regards,
Supreeth.K

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