12-02-2009 05:18 PM
Hi,
I have created a VI to read in two serial inputs and then process the data. I am reading the the data from a R/C controller and an IMU on a micro air vehicle. I created a case structure to write the data I need to a spreadsheet while the program is running. When I tested the VI I noticed that when I depressed the record boolean for my IMU, the part of the VI dedicated to processing the IMU slowed down significantly. I am recieving data from the IMU at 200 Hz and solving for the pitch and roll angles of the aircraft in labview.
What can be done to speed up my VI so that I can write to a spreadsheet while doing all of these calculations in labview?
12-02-2009 06:04 PM
Since file operations are a relatively slow process and you have the file operations embedded in the loops with the rest of your code, the file operations are slowing down your while loop.
What you should look at is the Producer/consumer architecture (search the forums, and go to New... in the File menu to find a template for it) so that the data you want to write to a file is passed to another loop by way of queue. That parallel while loop dequeues the data and writes it to a file at its own pace letting the producer loops continue with there activities at their pace.
I won't comment on the unneeded use of local variables and the flat sequence structure that don't look necessary either.