LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Clearing Event Sequence Triggers / Queue

Hi

 

Quick question, I have a "START" boolean button on the front page of my application. 

This START button is sat within an Event Structure and once pressed, the event structure is triggered and the application is started OK.

Problem is, and this has occurred a few times now is that the operator actually accidentally presses the button twice or catches the button during the process. Once the application is finished, and resets back to the beginning, the "accidental" mouse downs are stored and the program starts all over again, sometimes whilst the work is being unloaded. Its not a dangerous situation as such but the vacuum pump starts and tried to pull down the chamber whilst the door is open.

So, i was looking and trying to fully clear any accidental presses from the event queue, if this is the right area to look in. I did try using the Flush Event Queue function but this needs a "event registration refnum", where do I get this from? Is this even the right thing to do? Basically I want to press the button once and then ignore any other presses in the queue and only look for a change once entering the event structure again.

Any ideas? 

I did try the disable button node but it still seems to register mouse downs.

Thanks for any help you may be able to give.

 

Neil

0 Kudos
Message 1 of 27
(3,346 Views)

Hi Neil,

 

all your text implies you do something "wrong" or "not the way it is recommended"! Unfortunately you did not attach real code for us to verify/improve…

 

The event structure should be able to catch all events all the time. Why is your event structure NOT able to catch more than one START button press?

Why do you use "MouseDown" events? Use "ValueChange" events of your button!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 27
(3,340 Views)

Hiya

 

I can attach some code for sure, its on a machine with no network connection so need to copy it off.

The event structure is capturing events, but its storing the "START" button processes even when the process is half way through, these presses are stored I guess and once the start event routine is executed again is uses these stored presses and starts off again immediately.

I will also try the value change option you suggested. 

 

Neil

 

0 Kudos
Message 3 of 27
(3,324 Views)

It will be more clear once you run your code, but it sounds like you have a bunch of code running inside the event structure. That is not the right way to do this. You should move the code into a separate loop and send a message to the other loop when an event occurs.

 

As for the problem that you are having, I agree with GerdW that you should change to a Value Change event. This may not, however, completely fix your problem. There are a few ways that it can be fixed. You could set a flag and ignore the event if the flag is True. You could disable the button when the event occurs and then enable it again when the code triggered by the event. Once we see your code perhaps other ways would appear to be more appropriate.

0 Kudos
Message 4 of 27
(3,299 Views)

Hi Neil,

 


@NToombes wrote:

The event structure is capturing events, but its storing the "START" button processes even when the process is half way through, these presses are stored I guess and once the start event routine is executed again is uses these stored presses and starts off again immediately.


Yes, sure: that is the way the Event structure works!

All configured events are catched and executed as soon as possible.

 

I repeat from my last message:

The event structure should be able to catch all events all the time. Why is your event structure NOT able to catch more than one START button press?

and rephrase to make it more precise:

The event structure should be able to catch&handle all configured events all the time. Why is your event structure NOT able to catch&handle more than one START button press immediately?

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 27
(3,295 Views)

Hi johntrich1971

 

 

I have no other code inside the event structure. It is purely sat there awaiting the start button to be depressed and this then allows the program to continue onto the next case.

I have tried the disable button option but it still seems to recognise the problem hence why it might be a mouse down setting rather than a value change thing. I am going to change that once I can get onto the system again as its in alot of use.

I think its just the mouse down action is being stored and as soon as the program resets back to the beginning it sees the "mouse down" stored occurrence and starts straight away again.

I am tempted, however ugly it is to just use a while loop with 100mS loops and connect the button to the "Stop if True" terminal. Horrid I know but least it looks for the actual button press.

 

Neil

0 Kudos
Message 6 of 27
(3,284 Views)

Hi GerdW.

 

The Event is catching them all but I don't want it to, I only want it to capture the button press when that case is being executed. Any other unintentional presses at other times in the software should be ignored.

 

Neil

0 Kudos
Message 7 of 27
(3,282 Views)

@NToombes wrote:

Hi

 

I have no other code inside the event structure. It is purely sat there awaiting the start button to be depressed and this then allows the program to continue onto the next case.

I have tried the disable button option but it still seems to recognise the problem hence why it might be a mouse down setting rather than a value change thing. I am going to change that once I can get onto the system again as its in alot of use.

I think its just the mouse down action is being stored and as soon as the program resets back to the beginning it sees the "mouse down" stored occurrence and starts straight away again.

I am tempted, however ugly it is to just use a while loop with 100mS loops and connect the button to the "Stop if True" terminal. Horrid I know but least it looks for the actual button press.

 

Neil


If you're using the mouse down event then the disable button won't do anything. Just changing to value changed won't necessarily fix the problem either as two value changed events could also be cached. We really do need to see your code as there's likely a much better way to do what you are trying to do. Your polling method will very possibly have the same issue (I'm assuming that you are using a latching button). When you press the button it would latch on, be read, and exit the loop. If the button is pressed again it would latch on until it is read - the next time that you get to the loop. 

0 Kudos
Message 8 of 27
(3,276 Views)

Hi Neil,

 


@NToombes wrote:

The Event is catching them all but I don't want it to, I only want it to capture the button press when that case is being executed. Any other unintentional presses at other times in the software should be ignored.


Use the ValueChange event and disable the button afterwards.

Still ugly…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 27
(3,266 Views)

Hi John

 

Yes, thats why I changed it to a "Mouse Down", I remember now as the false to true action is logged for that iteration of the process but then when it gets back to the same point in the software again the true to false change is also logged.

I need to somehow get the code onto here to upload as its on a standalone machine in LV20 and this machine only has 19 on it, I have attached an image of the screen though, not that i guess its much help.

I am just looking for a solution that waits for a button press and then ignores that button again until its awaiting it to be depressed again.

 

Neil

0 Kudos
Message 10 of 27
(3,255 Views)