02-25-2007 07:24 PM
I have two while loop running parallel, one is reading data from Serial port and the other is reading data from USB. The one reading data from serial port, has multiple event case inside, I can used an event to stop the while loop by putting the stop inside the event loop. But it is proving difficult to stop the other while loop. I have used the local variable, but it is not compatible with Latch. With the other mechanical properties of stop it dose work properly. Here is my vis, please anybody know how to sort this?
02-25-2007 07:33 PM - edited 02-25-2007 07:33 PM
Place the stop button in the small loop and use the stop event terminal in the big loop. 🙂

Message Edited by altenbach on 02-25-2007 05:33 PM
02-26-2007 10:28 AM
Hi altenbach thanks for quick reply.
I have tried it, but there is a little problem with that. After debugging my program, I realized that after running my application a few times and stopping, the value of NewVal stacking to be true. This cause that the value of stop to be true and when running the application the small loop only execute once and stop.
Is there a way that I make sure that the NewVal set to be falls when starting the program? Or after quitting the program?
Regard
hanman
02-26-2007 11:37 AM
02-26-2007 11:49 AM - edited 02-26-2007 11:49 AM
Well, don't press the button to ON in edit mode before starting the program! 😮 It will stay true until the first time the value is read by the code when you run it.
If you think you cannot avoid that, initialize the stop button to default before entering the loop, such as in this image (right-click...create...invoke node...reinitialize to default).

(Also rIght-click on your stop button and change the mechanical action to "latch when released". (For some strange reason, your's is set to "latch until released"))
Message Edited by altenbach on 02-26-2007 09:50 AM