LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structure stops buttons from working

Dear Labview Community,

 

I have an issue where when i want to start the main loop of my program with an event structure. However after i trigger the event structure i can not actuate any of the buttons in my program. Maybe i have misunderstood event structures but after execution the structure should be irrelevant to the rest of the program or not? How does it affect the use of buttons at all? The Structure in question is the one at the bottom left with the "start" button triggering it.

Thank you for your help.

(I know the program is a bit messy and riddled with amateurish programming. Its my first big project and a work in progress.)

 

Regards,

Phillip

0 Kudos
Message 1 of 6
(191 Views)

Have you read Caveats and Recommendations when Using Events in LabVIEW - LabVIEW 2016 Help  ?

 

I see a problem where you have an event structure all by itself before your main loop starts.  It looks like you have it set to proceed when you hit the start button, but also set to lock the front panel until the event competes.  The problem is that if you happen to hit the start button again, you will trigger an event for that event structure, the front panel will lock, but you'll never be able to execute that event structure since it is no longer in the dataflow path.

 

That is definitely problem, but you may have more.

In general, all event structures belong in a while loop.  Don't have multiple event structures in a VI.  While that isn't necessarily a problem, when I see multiple event structures and people have event problems, it is because they don't know how to use event structures properly.  So please read that link above.

 

At the minimum, you should use a property node to disable and gray out that Start button within that event case, and have a property node enable it right before so that it is select-able again when your VI begins next time.

Message 2 of 6
(172 Views)
Highlighted

Another problem with your Event Structure concerns the Boolean elements that trigger Events.  Boolean Controls have a "Mechanical Action" that control how they work, including whether they "Push On, Push Off" (two-state button), "Push On, Release Off" ("Ding-dong, Door-bell button"), or (the default value for the "Square" Boolean Controls like "Stop" and "OK", "Latch When Released").  The "Latch When Released" Action is specialized for the Event Structure, where it switches when the button is released, and returns to its default value ("off") when it is read.  The way these buttons are designed to be used is to be placed within their "Value Changed?" Event.  When they are pushed and then released, the Event is triggered.  Their value at that time is "On", and if they are read and their value is used within the Event, the value "True" will result.  Whether or not the Control is "actively" read (meaning it has a wire coming out from it to something else), it will return to its default value, "Off".

 

Changing this to Switch Until Released (as you have done) will cause this control to trigger twice in "normal" Event operation, when pushed, and when released.  This may be something you want to do, but in most cases, these "Square" buttons are meant to be "one-time" signals -- "Stop" now (and stay stopped when I release the button), "It is OK now" (and will continue, probably, to be OK when I remove my finger), etc.

 

All this should have been explained in tutorial or class material discussing LabVIEW Boolean Controls.

 

Bob Schor 

Message 3 of 6
(158 Views)

Dead on, Bob.  I didn't think to look at the mechanical action.  That press and release is definitely causing 2 value changes that causes the front panel to lock up since the path of execution for the event structure is such that it is only seen for the first event.

0 Kudos
Message 4 of 6
(129 Views)

Putting the start button inside the event structure, the event structure inside a while loop and using the start button to stop the while loop solved the problem for me.

 

@bob i never had a class or tutorial on labview. all you see is self taught. 

0 Kudos
Message 5 of 6
(63 Views)

@PTimmer wrote:

@bob i never had a class or tutorial on labview. all you see is self taught. 


Bravo!  However, spending 3-6 hours with the free Tutorial material described on the first page of this Forum might give you some Basic Principles (including where to find more Help and Examples) that will facilitate self-learning.

 

Bob Schor

0 Kudos
Message 6 of 6
(35 Views)