LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

confusing behavior of button event

Hi all,

  I am learning the behavior of the mechanical action of the button. I want to implement something like this. I have two buttons START and STOP. Initially, STOP is disabled and START is enabled. Once START pressed, I disable START and enable STOP. After the START pressed, I update the string output every 6 seconds. I have timeout event triggered every 100ms and will terminate the program when STOP pressed. But I found that after START pressed, STOP will be enabled but STOP doesn't response to my mouse click. I try to set STOP as Latch or switch, doesn't work either

 

tt.png

0 Kudos
Message 1 of 15
(1,380 Views)

Lear about state machines. Event structures should never be hidden inside sequence frames. Note that both even structures will queue up events when they are triggered but they cannot react unless they are in the dataflow.

 

Also, if you want more detailed help, attach the VI, not an image. An image can never tell the whoe story. For example we cannot see the other event cases


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 2 of 15
(1,373 Views)

 


@altenbach wrote:

Lear about state machines. Event structures should never be hidden inside sequence frames. Note that both even structures will queue up events when they are triggered but they cannot react unless they are in the dataflow.

 

Also, if you want more detailed help, attach the VI, not an image. An image can never tell the whoe story. For example we cannot see the other event cases


I do want to attach the vi but the forum doesn't allow me to attach an attachment 😞

0 Kudos
Message 3 of 15
(1,366 Views)

What kind of error do you get? What browser are you using? Have you tried zipping the VI first?


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 4 of 15
(1,361 Views)

I cannot upload attachment in this forum so I post the code to other linked as follow

 

http://www.filedropper.com/t1

0 Kudos
Message 5 of 15
(1,358 Views)

@altenbach wrote:

What kind of error do you get? What browser are you using? Have you tried zipping the VI first?


This issue bugging me for long time. I emailed the admin also but no solution yet. I zip the VI but whatever file I attached, it said the content of the file doesn't matching the file. I try both IE and Firefox, the same error.

0 Kudos
Message 6 of 15
(1,356 Views)

Please try to find a upload location that is not peppered with deceptive links. Very annoying.

 

Here' what you uploaded so others don't nee to go there.

 

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 7 of 15
(1,351 Views)

Quick analysis:

 

  • Use latch action for the booleans, not exotic and most often inappropriate ones such as "switch until released". Once they are latch action, their terminals belong inside their respective event case.
  • The first inner sequence structure has no function (delete it!) and the other two can be eliminated by using proper data dependencies.
  • Use a single loop and a single event structure and keep track of the program state in a state variable in a shift register (e.g. an enum). No sequences needed.
  • There is no need for timeout events, because nothing special happend there (first event structure). So why spin the loop?
  • An event structure with only a timeout event is pretty useless (second event structure).

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 8 of 15
(1,346 Views)

@PKIM wrote:

But I found that after START pressed, STOP will be enabled but STOP doesn't response to my mouse click. I try to set STOP as Latch or switch, doesn't work either


Analysis: The start button is "switch until released", meaning it will fire two events, one on press and one on release. Once the button is pressed, the first loop stops and the up event can no longer be handled  immediatelyand the event structure will queue it up, expecting to be in the dataflow again soon. However this will never happen again due to the code design. The start event is set to lock the front panel until the event completes, but since the up event on the start button can never complete, the front panel will be locked up forever. Seems logical.

 

(Just to make you understand what is happening and why your current code desing is fundamentally flawed.)


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 9 of 15
(1,338 Views)

@altenbach wrote:

@PKIM wrote:

But I found that after START pressed, STOP will be enabled but STOP doesn't response to my mouse click. I try to set STOP as Latch or switch, doesn't work either


Analysis: The start button is "switch until released", meaning it will fire two events, one on press and one on release. Once the button is pressed, the first loop stops and the up event can no longer be handled  immediatelyand the event structure will queue it up, expecting to be in the dataflow again soon. However this will never happen again due to the code design. The start event is set to lock the front panel until the event completes, but since the up event on the start button can never complete, the front panel will be locked up forever. Seems logical.

 

(Just to make you understand what is happening and why your current code desing is fundamentally flawed.)


Thanks for the analysis. I think I understand the reason now. It is not easy to use event control, the thinking of programming is not straightfoward but I am learning ... 🙂

0 Kudos
Message 10 of 15
(1,323 Views)