02-15-2006 03:18 PM
How do I monitor the keyboard for a key press? I would like to use the Esc key to abort a process. I have no problem monitoring a daq input but I do not know how to monitor the keyboard.
Thanks for any support.
Paul
02-15-2006 03:20 PM
You can use an Event Structure and monitor the VI for the "Key Down" event, and check to see if it is the Esc key. Read the LabVIEW Help for more information about Event Structures.
-D
02-15-2006 04:44 PM
02-16-2006 12:10 PM - edited 02-16-2006 12:10 PM
Hi Paul,
The suggestions above are all great suggestions. In fact, from an efficiency standpoint, they're optimal. If you only have the Base version of LabVIEW, however, you won't be able to use Event Structures.
In that case, there are some VIs in the Input Device Control functions palette called Initialize Keyboard and Acquire Data that you can use to continuously poll the keyboard for a specific key stroke such as Escape. I've attached a screenshot with an example.
Message Edited by Jarrod S. on 02-16-2006 12:11 PM
02-16-2006 02:07 PM
Thank you all very much.
The last suggestion with the keyboard control solved my problem. I was trying to use the event option per the attached file with no success.
Thanks again,
Paul