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.
08-13-2008 11:58 AM
Normally, you can not stop while loop inside a event structure. But the vi attached here can do it...
If you create a new vi: drag a new event structure but copy the while loop from the vi attached, you won't be able to stop the loop.
Can anyone tell what's going on?
Thanks
08-13-2008 12:03 PM
By default, event structure lock the front panel until the event completes.
Here this option is uchecked in the event configuration, allowing reading of the cancel button.
It is still not a good idea to trap event structures with an inner loop.
08-13-2008 01:31 PM
Thank you, altenbach!
I read your article before
More questons:
If I use your idea, set up the timeout case as in the new vi attached, the problem is, when you run another case (for example, if you press 'others' button), the outside loop will run once, I do not want that happen. How can I modify it?
08-13-2008 01:32 PM
08-13-2008 01:35 PM
Hi wbcat,
do you mean the only loop you have in your code? Without this loop you can execute only one event. You need the loop to run your program. Why don´t you want the loop running? If you need a counter for some special events, then create a shift register and add one in your specified event.
Hope it helps.
Mike
08-13-2008 01:40 PM
Well, the outer loop MUST run in order to service the event. No way around that.
Your VI has several problems:
08-13-2008 01:44 PM - edited 08-13-2008 01:46 PM
I no longer have LabVIEW 7.1, but here's a quick draft. Use similar code for the otehr cases, e.g. add a "+1" to the timout case, etc.
08-13-2008 01:45 PM
Thanks, altenbach!
>>The timeout is zero by default
you are right. But if you set the default as -1, it works
08-13-2008 01:47 PM
wbcat wrote:Thanks, altenbach!
>>The timeout is zero by default
you are right. But if you set the default as -1, it works
Yes, but is still very clumsy code. Don't abuse front panel objects as "variables".
08-13-2008 02:01 PM
I agree, altenbach
by the way, thank MikeS81 for your concern
More questions for your guys:
the real code inside the loop is a single laser pulse, while the "others" are different laser setups, like voltage, etc...
I plan to set every single setup and then run the laser pulse loop to check how the laser works.
But I hate laser fires without control: when I set "others", it will fire once. I donot like that