07-26-2011 10:23 AM
@smercurio_fc wrote:
That "solution" is no better than your original. Using a property node instead of a local variable gains you absolutely nothing. A property node requires a thread switch to the user interface thread. In some cases this can cause huge performance impacts. I don't know why you don't want to use an event structure. Are you using LabVIEW Base which has no access to event structures? If you must use loops, then a better way to handle a loop that has a long loop time is to actually have the loop time short and then use a case structure to determine if it's time to execute the loop.
Something like this, for example
It would also be a good idea to place the stop local variable in a sequence structure and read its value AFTER all your processing is completed. Otherwise you run the risk of doing an extra loop iteration. As written above there is a very high probability the local variable very early in the loop.
07-26-2011 10:28 AM
This is an easy way and it does not depend on loop time.
07-26-2011 10:45 AM - edited 07-26-2011 10:52 AM
@aeastet wrote:
This is an easy way and it does not depend on loop time.
This is similar to this.
I would use value changed and keep the button at the latch mechanical action. Remember, you only need an event structure in the "other loop" (the one without the stop button). The loop with the stop button can be polling normally.
07-26-2011 10:51 AM
@Mark Yedinak wrote:
It would also be a good idea to place the stop local variable in a sequence structure and read its value AFTER all your processing is completed. Otherwise you run the risk of doing an extra loop iteration. As written above there is a very high probability the local variable very early in the loop.
That's a valid point, though the intent of the example was just to show the technique of how to deal with loop times that are supposed to run with a long duration, but still have a responsive UI. I still think the best solution is to use an event structure, and I don't quite understand the OP's apparent reluctance in doing so.
07-26-2011 10:53 AM
@smercurio_fc wrote:
@Mark Yedinak wrote:
It would also be a good idea to place the stop local variable in a sequence structure and read its value AFTER all your processing is completed. Otherwise you run the risk of doing an extra loop iteration. As written above there is a very high probability the local variable very early in the loop.That's a valid point, though the intent of the example was just to show the technique of how to deal with loop times that are supposed to run with a long duration, but still have a responsive UI. I still think the best solution is to use an event structure, and I don't quite understand the OP's apparent reluctance in doing so.
I agree, the event structure is defintely the preferred choice. I also like to use queues/notifiers. This gives an added benefit that messages can be sent which allows more than just a Stop.
07-27-2011 09:03 AM
thanks all for the loads of ideas !