LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

vi stops responsing

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

0 Kudos
Message 1 of 4
(1,605 Views)
  • Events are for controls and user interactions, not for indicator changes. Sorry, You named both a contrl and indicator "event". That's a really bad idea....
  • Once in the run state, pressing "event" a second time will lock up your VI, because the event is set to lock the front panel until it completes, but the event can never complete because it only can execute in the init state.
  • Once in the "run" state, you VI can never get out of it.

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.

0 Kudos
Message 2 of 4
(1,589 Views)

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

0 Kudos
Message 3 of 4
(1,557 Views)

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

0 Kudos
Message 4 of 4
(1,542 Views)