LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cpu utilization is 100 % !!!

I created a simple vi to switch a boolean LED on or off. The vi has just a boolean control and indicator. On running the VI the CPU utilization in task manager shows 100 %. How can this happen???
0 Kudos
Message 1 of 5
(3,060 Views)
Shakes wrote in news:50650000000800000094B70000-
1073519706000@exchange.ni.com:

> I created a simple vi to switch a boolean LED on or off. The vi has
> just a boolean control and indicator. On running the VI the CPU
> utilization in task manager shows 100 %. How can this happen???
>

It is because the OS is so kind to give you all of the available CPU
resources to run your loop.

To give the OS a better chance to switch from LabVIEW to another
task/program put a
"Wait Until Next ms Multiple" function or a "Wait (ms)" function inside the
loop.
If you wire a constant with 0 to the input of the wait your VI will get all
of the resources available, but the OS has a better chance to switch to
other applications (Without this wait it is a bigge
r chance that the PC
seems to hang).

Even better, wire a constant of 200 to the Wait function. As a user
interface this should give a suitable response.

--
Rolf
Message 2 of 5
(3,060 Views)
Thanks ROlf. It worked 🙂
0 Kudos
Message 3 of 5
(3,060 Views)
> I created a simple vi to switch a boolean LED on or off. The vi has
> just a boolean control and indicator. On running the VI the CPU
> utilization in task manager shows 100 %. How can this happen???

This has already been answered, but just to be clear, your loop wasn't
told to run at a particular rate, so it runs as fast as possible. If
you were to watch the i on your loop you'd probably get millions of
Boolean checks per second. I think that putting a delay in the loop is
fine for simple applications, but if you are interested, you might want
to look at some of the event examples too. This lets you write in a
little more complicated way that executes the loop only when absolutely
necessary. It isn't important here, but if you had an instr
ument that
took 0.5 seconds, this might be more appropriate.

Greg McKaskle
Message 4 of 5
(3,060 Views)
thx greg. i will try it and come back:)
0 Kudos
Message 5 of 5
(3,060 Views)