11-06-2008 11:10 AM
I've attached a snapshot of the vi program I implemented in labview 8.5, the hardware is USB-6251. Basically I'm using the DAQ card to acquire an analog voltage at 1M samples/sec and the data acquisition is externally triggered. For each trigger 350 samples are saved in an array and after simple signal processing an output is calculated.
I use "for loop" to repeat the above procedures 256 times, and 256 outputs are saved in a 16 by 16 array, which is used to reconstruct a gray image. The problem I noticed is that the labview program is not running fast enough because I have to wait for very long time to get one image. Is it because of the "for loop" running slowly between two consecutive iterations? Is there any way I can speed up this program? Is using a faster computer gonna help? Thanks in advance and I'm looking forward to any advice.
Jerry
11-06-2008 11:30 AM
11-06-2008 11:49 AM
Hi Jerry,
It looks to me as though the problem may be to do with the amount of tasks you are performing for every iteration of the for-loops. I'm assuming that you have all of your DAQmx VIs (eg. DAQmx Create Virtual Channel, DAQmx Read etc.) contained within the 'Acquire Data' subVI. Could you please confirm that? If that is the case then that could be very processor-intensive and hence could be why your application is running slowly. As a rule of thumb, it is best to keep everything possible outside of the loops, and hence perform each task once only. Many examples of how to do this may be found by selecting Help>>Find Examples from the LabVIEW pull-down menu, before navigating to Hardware Input and Output>>DAQmx>>Analog Measurements>>Voltage. Most of the examples concerning continuous acquisition (those beginning in 'Cont Acq') will give a good idea of what should be placed inside and outside of iterative loops.
Hope this helps, don't hesitate to ask if you need anything clarified. Let me know if it has any affect on the speed of running your application and if not, then I can assist you further.
Regards
11-06-2008 11:50 AM
Hi Dennis,
I'm sending you the vi file, sorry I didn't make it clear enought, the top level vi is acquire.vi, I'm using labview 8.5.
In the front panel, the sampling rate is set to 1M samples/sec, number of samples is 350.
Right now I have to wait 10 to 15 seconds to get one image, but my external trigger (from FPGA) is 2KHz, which means the frame rate should be 2000/256, which is around 8fps. Thanks in advance.
Jerry
11-06-2008 11:52 AM
Hi Jeremy,
Thanks for you reply. Do you have time to take a look at my vi's which are attached in my second post and point me some directions?
Jerry
11-06-2008 12:27 PM
11-06-2008 04:26 PM
11-06-2008 04:34 PM
Of course you can place them outside the for loop. You seem to not understand that by default, a for loop will automically auto-index any wire entering or leaving the loop. You can simply right click on your exit tunnel and select 'Disable Indexing'.
p.s. A while loop can run an exact number of iterations just like a for loop. You just have to compare the iteration count to a stop condition (i.e. Greater/Equal to a number).
11-07-2008 10:03 AM
Jerry,
If you disable auto-indexing, you will want to check for the status of the error at each iteration of the loop (similar to "Cont Acq&Graph Voltage-Int Clk.vi" shipping example). If an error occurs in the middle of your iteration count, you should abort the loop, or else you will lose the error information. An alternative would be to use a shift register (right click on the tunnel and click replace with shift register). A shift register will pass the value at the output back to the input for each iteration, thus saving information from each iteration. Either option should do the job.
ck.x