LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Optimising Execution speeds

Hi,
I'm constructing a program that sends commands down the serial port and
reads the data coming in. This data is in the form of character strings
which I am converting in various conversion VIs to data that can be
displayed on dials etc. I'm experiencing problems trying to get the dials
to run smoothly and wondered what ways other than mentioned in the help
files are there to optimise performance. So far I have placed all the
conversions in a separate VI which then writes to global variables. These
globals are then called in the display VI in a while loop - iterating as
fast as possible. I load the conversion VIs up at the start of opening the
display VI and set them running in the background when required. My ma
in
problem is I want the data displayed on the dials to be as near as is
possible to real-time. I would be grateful for any help. The serial port
link is running at 19200 baud.

Regards,
Martin.
0 Kudos
Message 1 of 2
(1,540 Views)
> I'm constructing a program that sends commands down the serial port and
> reads the data coming in. This data is in the form of character strings
> which I am converting in various conversion VIs to data that can be
> displayed on dials etc. I'm experiencing problems trying to get the dials
> to run smoothly and wondered what ways other than mentioned in the help
> files are there to optimise performance. So far I have placed all the
> conversions in a separate VI which then writes to global variables. These
> globals are then called in the display VI in a while loop - iterating as
> fast as possible. I load the conversion VIs up at the start of opening the
> display VI and set them running in the background when required. My main
> problem is I want th
e data displayed on the dials to be as near as is
> possible to real-time. I would be grateful for any help. The serial port
> link is running at 19200 baud.
>

As fast as possible is usually way too fast for UI stuff, and consumes too
much CPU time not allowing the other loop to run as often as you like. You
can either put a delay in the UI loop, like 10ms, you can put the two
loops together, or you can use synchronization VIs to control how often
the UI loop is coaxed to run.

Another thing to do is to use the profile tool to see how much time different
VIs are taking. You can then focus on easing the load on that VI.
Often it
is due to a runaway loop that is guaranteed to eat as much processor
time as
is available. While this often seems like a good idea at the time, it can
mean that globals are being polled 100,000s of times per second, and even
though the controls are fast, 60-100Hz is all the screen updates anyway; so
you want to slow it down to run less often, which will
allow for the other
tasks to run more quickly or just lighten the CPU load and make the machine
feel more responsive.

Greg McKaskle
Message 2 of 2
(1,540 Views)