From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
03-22-2009 08:54 PM
Hi,
As the subject says, it is possible to use a key down event (wired to the stop terminal) to stop a while loop from running? More specifically, I need to use the "S" and "L" buttons to do this.
All feedback is much appreciated!
Thanks.
03-22-2009 09:14 PM - edited 03-22-2009 09:14 PM
03-22-2009 09:23 PM
04-12-2009 10:23 PM
I'm having trouble using a key down event to stop a while loop.
I am using the structure in the attached picture.
I want the VI to display a random picture (first frame of the flat sequence) and then wait a certain amount of time (second frame of the flat sequence). I want this process to repeat until the spacebar is pressed (the event structure with a key down event) which terminates the while loop.
For some reason, instead of doing this the structure displays a random picture, waits for a keystroke and once it is pressed it then waits and the VI stops after. If I completely remove the event structure, and just have the while loop on Continue If True, the picture generation and wait work fine so I figure the problem has something to do with the event structure.
Any help is always appreciated!
04-12-2009 11:05 PM
Your event structure blocks the loop from spinning. The loop cannot repeat until everything in it has completed and your event structure only completes if a key is pressed. Think dataflow!
Try execution highlighting for debugging.
Quick solution: make the event structure transparent by adding a timeout case and wiring a reasonable value to the timeout terminal.
Not much more can be said. Your VI image is incomprehensible because things are hidden and/or unlabeled. Also some things make very little sense. Why don't you attach the actual VI instead of a picture? It would be much easier for us to debug!
04-13-2009 01:45 AM
Attached is the VI (it is run as a subVI in another program).
Sorry about the lack of information.
04-13-2009 04:24 AM
04-13-2009 08:25 PM
Thanks GerdW!
I've only been using Labview ~5 months with no background in any sort of computer programming so any help I get is more than appreciated!