08-23-2018 11:49 AM
My question is can vi's that use while loops be turned into sub vi's and used in the main while loop of a main program. So I have these vi's that work just great. They have their own while loops. Should I leave them like that, or can get rid of their while loops and put the code into my own main loop? There by using only one main while loop.
08-23-2018 11:52 AM
Yes but keep in mind they will iterating at the same rate so if one loop runs slow the rest will slow down to the iteration rate of the slowest.
Ben
08-23-2018 12:05 PM - edited 08-23-2018 12:07 PM
Your question is way too vague to give an answer. There are many reasons for while loops and only some can be eliminated by using the while loop of the caller instead. If these are toplevel loops that just poll/repeat, you are fine. If these are tight, self terminating while loops of an iterative procedure (e.g. newton-raphson), they need to stay. Same if they need to spin independently at different rates.
If you are a relatively new programmer, feel free to show us your code drafts. Most likely we will be able to give much more specific and useful advice.
08-23-2018 12:41 PM
Yes, I am new. I recently completed core1 and core2. So trying to put it all together intelligently. Ok I will put something together and post the code. Unfortunately, there is another Labview programmer here that is not much help to me. I think he see's my efforts to be a good Labview programmer a threat. Its too bad he acts that way. I'm only trying to help. But I have the NI forums; Thank Goodness. Ok, I will post code.
Regards,
LeatherNeck1957
08-23-2018 01:37 PM
@Leatherneck1957 wrote:
Yes, I am new. I recently completed core1 and core2. So trying to put it all together intelligently. Ok I will put something together and post the code. Unfortunately, there is another Labview programmer here that is not much help to me. I think he see's my efforts to be a good Labview programmer a threat. Its too bad he acts that way. I'm only trying to help. But I have the NI forums; Thank Goodness. Ok, I will post code.
Regards,
LeatherNeck1957
Maybe he's Navy...?
08-23-2018 02:08 PM
@billko wrote:
@Leatherneck1957...
Regards,
LeatherNeck1957
Maybe he's Navy...?
This is of far off-topic that it goes into a spoiler!
A sailor and a marine are drinking in a bar after both completing boot camp. They sneer at each other and match each other beer for beer. Eventually the have to respond to nature and visit the Men's room. After finishing their business they both go to the sink. The marine washes his hands and the sailor proceeds to comb his hair.
Marine : "In boot camp they taught us to wash our hands after using the facilities."
Sailor :
That joke of course can be told either way.
Ben
Swabbie1958
08-24-2018 07:35 AM
Hoorah Swabbie1958