LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set up different priorityies in one VI

Such like set up different parts in one VI with
different priority?
0 Kudos
Message 1 of 5
(3,082 Views)
It will helps if you would to elaborate more, such as what is your VI's intention etc.

One will then able to tell you more, ya?


Cheers!
ian.f koo
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
Message 2 of 5
(3,082 Views)
Such like in one vi,which name is 2tasks.vi.

I have two indepent loops, one is add one ,start
from 0. The other one is add one, start from 0 too.
How can make loop1 run fast than loop2.

Thanks
0 Kudos
Message 3 of 5
(3,082 Views)
If you just want to control how fast each loop runs, use a Wait (ms) or Wait until Next ms Multiple in each loop.

If LabVIEW is actually running out of processor time to handle both tasks at the speed you need, I think you'll need to put the higher-priority loop inside a subVI and look at changing the execution thread and priority settings for that subVI (see LabVIEW docs for more details). But make sure this is really the problem before going down this route: there's no point optimising something in a program unless it is actually causing a bottleneck.

One tip: it is a good idea to put a Wait (ms) in all loops, even with a wait time of zero, because it helps LabVIEW to do smooth multitasking between them. I'm sure there's an article about this somewhere on the
website if you search for it.
Message 4 of 5
(3,082 Views)
> I have two indepent loops, one is add one ,start
> from 0. The other one is add one, start from 0 too.
> How can make loop1 run fast than loop2.
>

I'm not sure that you want to use priorities, and if you do use them,
you also need to use Wait MS calls or something else to regulate how
often your loop runs.

Priorities determine who gets to cut in line. If a lot of tasks are
lined up to get into the CPU, the high priority task gets to walk past
the normal ones and use the CPU as much as he likes, no matter how long
the others have been waiting.

So, first thing to do is determine how fast each should run and put
delays into the loops. If you then have several tasks that wake up
periodically and you'd like one to interrupt the others, make i
t a subVI
and give it a higher priority, otherwise leave priorites alone.

Someone else mentioned putting Waits of zero in every loop. Just to be
clear, this does cause finer grained execution, but at the expense of
efficiency. This finer grain causes more runs through the scheduler,
and there are certain loop types that are probably better off without
it. A quick measurement on my machine shows that 1,000,000 schedules
costs about 800ms.

Greg McKaskle
0 Kudos
Message 5 of 5
(3,082 Views)