LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Timing VI's

Hi all,
I have a question that I assume has a simple answer. When using the timing Vi's (Wait(msec), Tick Count, and Time Delay), I have found that execution of all Vi's (main Vi's or calling Vi's) are delayed. I would like to be able to delay the execution of a subvi, without affecting the main or calling Vi... Is there a way to do this? Sample code would be appreciated.
Thanks again,
Ryan
0 Kudos
Message 1 of 8
(3,198 Views)
Any suggestions?
0 Kudos
Message 2 of 8
(3,168 Views)

Ryan,

I'm not sure exactly what is the issue is.  Could you upload your VI so I could take a look and see what you're trying to do?

Thanks,

Stephen Meserve
National Instruments
0 Kudos
Message 3 of 8
(3,162 Views)
Ryan,

Can you tell us what you are trying to do? Or better yet, post code which illustrates your problem.

Guessing, I suspect that you need parallel nodes.

Lynn
0 Kudos
Message 4 of 8
(3,160 Views)

The short answer is no.  What you are discribing breaks data flow programming.  In LabVIEW, code executes as nodes are finished.  For example loops only execute the next iteration when all the code inside is done.

So if your main VI is waiting for a response from the SubVI, or the SubVI is in a structure then that Main VIs stucture can not finish until the subVI is done.

The caveat is that I am assuming you are using the SubVI for a value or have it in a structure.  If you have 2 sections of code that are fully parallel (think 2 totally seperate loops) then the subVI in 1 loop has no effect on the other.

Without your code we can't really tell you which you are and why you code is not working as expected.

0 Kudos
Message 5 of 8
(3,158 Views)
Thanks,
I will try to post the code shortly. I am having a sub vi check a device on the serial port. This sub vi is not a loop but is in the main VI loop and executes every cycle. The response that is given determines the status of some LED's on the main VI. I would like to slow the rate at which this VI executes with out slowing the entire application. Is there a proper way to delay the execution of just this sub vi but not the main vi?
Thanks for the help!
Ryan

PS: The code is working properly, the serial port is bandwith is getting hogged by this one sub vi.

Message Edited by Valcon on 06-14-2007 08:30 AM

0 Kudos
Message 6 of 8
(3,137 Views)
Ryan,

Certainly it is possible to have different portions of the progrma run at various rates. The best way to do it depends on the structure of the program. Posting your VIs will give us a starting point. Save it with some typical values as default and put some comments (free text labels) in various places to describe what works and where you are having problems.

Lynn
0 Kudos
Message 7 of 8
(3,131 Views)
Please do post the code so we can take a look at what we can do to restructure your code.
One thing that comes to mind is to utilize the "producer consumer" model to architect your program, where the main portion of your code can execute in a while loop whereas your subVI can execute in a different while loop.  We can have two while loops running in parallel, and pass the data back and forth with a buffer.  You can look at the templates provided in LabVIEW (if you have version 8.2) by going to File->New...->VI->From Template->Frame Works->Design Patterns and look at the producer/consumer architecture.  Beware of possibly race conditions if you use this architecture.  Also, if there's data dependency between your subVI and other portions in your main VI, your code still has to wait for your subVI to produce those data, in which case, your mainVI will still have to slow down if your subVI slows down.
0 Kudos
Message 8 of 8
(3,092 Views)