04-26-2020 12:09 PM
hi friends
please explain why this simple vi doesn't work?
the vi consists of two buttons, one (whileBtn) inside a while loop and second (eventBtn) is used for an event structure. the event structure is only available in "initialize" case. when you push the event button, the vi switch to "run" case. before you press event button, the whileBtn button works properly (in the initialize case). then, when you press event button for first time that calls the run case then, the whileBtn button works properly again. but, if you press the event button again, the vi will stop responding.
thanks
04-26-2020 12:48 PM - edited 04-26-2020 12:58 PM
Overall, your code makes very little sense. Can you explain what you are trying to achieve. I am sure there is a very simple solution. It is also typically a bad idea to hide event structures inside case structures.
Start with the tutorials.
04-26-2020 01:39 PM
thanks
really sorry for my bad presentation file.
I've perceived from your reply that event handler will always execute even if it is disabled.
I am designing a test machine. I've used state machine technique for managing the required steps of the test. the first step is initializing (getting data from the database and ...), the second state "waiting for event" where the user interacts with the interface and finally presses the start button in which calls the next state. now, if the the user clicks any button during the test, the vi will crash.
it is better to ask, using event structure in a case is wrong?
thanks
04-26-2020 02:37 PM
When I read your initial question and saw the word "Event", I thought you were talking about the Event structure (found on the Structure palette), particularly as you were talking about "pushing buttons" to make things happen (something that many LabVIEW Developers consider an "event").
The best advice I can give you at the present time is to take advantage of the NI Tutorials (which are currently free!) immediately, and Learn LabVIEW. They are actually pretty good (I'm taking a few, myself, to learn aspects of LabVIEW I hadn't experienced yet). The URL that I found on the Web is https://learn.ni.com/training . Start with Core 1, and do the exercises.
Bob Schor