Using a Script to Output Keypad Data to Console
This project streams key press data from the Pmod KYPD. The presses are displayed on the console in WaveForms' Script Editor instrument. The script can be used in any project that requires input from the Pmod KYPD.
The Pmod KYPD uses pull up and pull down resistors to determine which rows and columns have closed switches, correlating to button presses. See the Pmod KYPD Schematic for the KYPD circuit diagram. The Discovery device detects button presses by scanning through DIO pints 0-4. Those pins are set as open drains, meaning that when the Discovery activates a certain pin, it provides a path to ground. Otherwise, inactive pins provide a high impedance (high Z). If a key is pressed, DIO pins 4-7 will detect a logic low signal on the row that was selected. By correlating the row and column to an array containing the possible characters, the script prints the key presses.
- A Discovery Device with Digital I/O:
- An Analog Discovery (Legacy) can also be used.
- Pmod KYPD, a 16-button keypad
1. Hardware Setup
This script requires that Pmod KYPD be connected to the Discovery device's DIO Pins as seen in the image to the right.
Finish the hardware setup by plugging the Discovery device into the computer.
2. Software Setup
Download and extract the WaveForms workspace from the Keypad Output to Console Workspace ZIP Archive (also linked in the inventory section, above).
Open WaveForms. Upon launch, WaveForms will generate a prompt asking to switch to the device used with the workspace. As this is the device originally used when the workspace was created and archived, select No. Navigate to Settings → Device Manager in the menu bar at the top of the window, to check that the active device is your Discovery.
3. Running the Script
Once the connections are made, open the workspace in WaveForms. Press the Run button () in the Script window. The Script Output pane will show the key presses as they're detected. The script is designed so that each time a key is pressed, only a single key press is registered.
For more guides and example projects for your Test and Measurement device, please visit its Resource Center, which can be found through this wiki's Test and Measurement page.
For technical support, please visit the Digilent Forums.