Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
test-and-measurement:digital-discovery:pmod-kypd-output-to-console [2022/09/12 18:14] – changed forum.digilentinc.com to forum.digilent.com jeff.greenberg_ni.comtest-and-measurement:digital-discovery:pmod-kypd-output-to-console [2022/10/04 11:38] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Using a Script to Output Keypad Data to Console ======
 +<WRAP group> <WRAP column half>
 +{{ reference:test-and-measurement:analog-discovery-2:pmod-kypd-output-to-console:pmod-kypd-top.png?400 |}}
 +</WRAP> <WRAP column half>
 +{{ reference:test-and-measurement:digital-discovery:pmod-kypd-output-to-console:kypd-workspace.png?400 |}}
 +</WRAP> </WRAP>
 +===== Introduction =====
  
 +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 {{/reference/pmod/pmodkypd/pmodkypd_sch.pdf|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.
 +
 +----
 +===== Inventory =====
 +  * A Discovery Device with Digital I/O:
 +    * [[https://digilent.com/shop/digital-discovery-portable-usb-logic-analyzer-and-digital-pattern-generator/|Digital Discovery]]
 +    * [[https://digilent.com/shop/analog-discovery-studio-a-portable-circuits-laboratory-for-every-student/|Analog Discovery Studio]]
 +    * [[https://digilent.com/shop/analog-discovery-2-100ms-s-usb-oscilloscope-logic-analyzer-and-variable-power-supply/|Analog Discovery 2]]
 +    * //An Analog Discovery (Legacy) can also be used.//
 +  * [[https://digilent.com/shop/pmod-kypd-16-button-keypad/|Pmod KYPD]], a 16-button keypad
 +  * {{reference:test-and-measurement:analog-discovery-2:pmod-kypd-output-to-console:script-keypad-output-to-console.zip|Keypad Output to Console Workspace ZIP Archive}}
 +
 +----
 +===== Setup Instructions =====
 +==== 1. Hardware Setup ====
 +<WRAP GROUP> <WRAP COLUMN HALF>
 +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.
 +</WRAP> <WRAP COLUMN HALF>
 +{{reference:test-and-measurement:analog-discovery-2:pmod-kypd-output-to-console:pinout.png?400|}}
 +</WRAP> </WRAP>
 +----
 +==== 2. Software Setup ====
 +Download and extract the WaveForms workspace from the {{reference:test-and-measurement:analog-discovery-2:pmod-kypd-output-to-console:script-keypad-output-to-console.zip|Keypad Output to Console Workspace ZIP Archive}} (also linked in the inventory section, above).
 +----
 +<WRAP GROUP> <WRAP COLUMN HALF>
 +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.
 +</WRAP> <WRAP COLUMN HALF>
 +{{reference:test-and-measurement:digital-discovery:pmod-kypd-output-to-console:device-manager.png|}}
 +</WRAP> </WRAP>
 +----
 +<WRAP GROUP> <WRAP COLUMN HALF>
 +Open the //keypad// workspace, found in the folder extracted from the archive, in WaveForms.
 +</WRAP> <WRAP COLUMN HALF>
 +{{reference:test-and-measurement:digital-discovery:pmod-kypd-output-to-console:open-kypd-workspace.png?600|}}
 +</WRAP> </WRAP>
 +----
 +==== 3. Running the Script ====
 +<WRAP GROUP> <WRAP COLUMN HALF>
 +Once the connections are made, open the workspace in WaveForms. Press the **Run** button ({{reference:test-and-measurement:analog-discovery-2:pmod-kypd-output-to-console:run-button.png|}}) 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.
 +</WRAP> <WRAP COLUMN HALF>
 +{{ reference:test-and-measurement:analog-discovery-2:pmod-kypd-output-to-console:kypd-output.png?600 |}}
 +</WRAP> </WRAP>
 +----
 +===== Final Notes =====
 +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:start]] page.
 +
 +For technical support, please visit the [[https://forum.digilentinc.com|Digilent Forums]].
 +
 +{{tag>project digital-discovery analog-discovery-2 analog-discovery analog-discovery-studio}}