LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pressing "Ctrl" key stop my VI

Solved!
Go to solution

Hi all,

My VI stop responding when I press any special key. Try running my VI attached in this post. While the VI is running, press any arrow key, and you may find that the value of the indicator "Horizontal position" and "Vertical position" changes accordingly. However, once a special character key is press, such as the "Ctrl" key or "Caps Lock" key, the VI stop responding. Anyone can tell me how to avoid this?

Thanks..

Best regards,
Julianti

Download All
0 Kudos
Message 1 of 10
(3,616 Views)

If you remove the generate fornt panel activity vi and remove the timeout on the event structure the vi works properly.

 

17739i9C2AFFE04C4B8BD3

 

Why are you generating activity every time the loop iterates?

Tim
GHSP
0 Kudos
Message 2 of 10
(3,603 Views)

Hi aeastet,

 

Thanks for your time and suggestion. If I removed the constant to the Timeout terminal, the VI will not respond when I click the Stop Button using mouse without pressing the keyboard.

 

I would like to keep the "Wait for front panel activity" because there are actually some other functions for image processing (not included in the attached VI) in the While Loop.

 

Regards,

Julianti

 

 

0 Kudos
Message 3 of 10
(3,579 Views)

I believe that the wait is what is causing the problem. I do not understand why the stop will not work but I will deferr to you that what you have done will work for that.

Tim
GHSP
0 Kudos
Message 4 of 10
(3,573 Views)

As I said replying to your other post, I agree with  aeastet.

Infinite timeout in the Event Case will be equivalent with "Wait for front panel activity": of course you should add a case to handle also the "Stop" button, then everything will be fine.

 

Speaking about why your VI hangs when pressing ctrl... I don't know.

It's interesting to note that if you remove the "Key down" event you can press ctlr & c. without blocking the vi.

 

Marco

Message 5 of 10
(3,571 Views)

Hi aeastet,

 

Do you mean that we must not use "Wait for front panel activity" together with Even Structure?

 

Thanks.

 

Julianti

0 Kudos
Message 6 of 10
(3,564 Views)

Yes, I would take it out all together. The event structure will wait until someone pushes a button or does something that you have an event setup for.

Tim
GHSP
0 Kudos
Message 7 of 10
(3,559 Views)
Solution
Accepted by topic author Julianti Sam

Also if you want to react to the stop button all you have to do is add the event. See the attached file.

Tim
GHSP
Message 8 of 10
(3,558 Views)

You can also remove the "Lock front panel until event case completes" under edit events to prevent it from happening.

"Ctrl" input will not increase the loop itteration thou.

0 Kudos
Message 9 of 10
(3,553 Views)

Thank you to you all so much....  I have the VI working properly now. Smiley Very Happy

Also, I learnt that Infinite timeout in the Event Case will be equivalent with "Wait for front panel activity". Thanks!!

 

Best regards,

Julianti

0 Kudos
Message 10 of 10
(3,533 Views)