Purpose
This lab focuses on utilizing the Pmod (peripheral module) input implemented on Digilent FPGA boards to allow user interaction through a 16-button keypad. With this, we will program the FPGA to create a simple hexadecimal calculator capable of adding and subtracting up to four-digit hexadecimal numbers. These numbers will be input by the user, with momentary push-buttons attached to act as operation inputs for addition, subtraction, clearing, and equals. These results will then be displayed on a four-digit seven-segment, as utilized in labs 1 and 2.
Digilent Pmod Protocol
Digilent features numerous different peripheral modules they refer to as "Pmods". A handful of them can be found here. To make things very simple, Digilent introduced a standardized pinout that would allow their FPGA boards to interact with all Pmod IPs. This pinout can be found below in a diagram.
Here, Pins 5 and 11 are reserved for ground, pins 6 and 12 are for VCC, and the rest are for the Pmod to transmit data through signals.
16 Digit Keypad
The 16 digit keypad comprises of 16 momentary push buttons, labeled from '0' to 'F' in hexadecimal. The mapping of these pins with respect to the Pmod diagram shown in the previous section can be found below.
In the keypad design, values are continuously scanned to read the value that the user is inputting.
To accomplish this, the columns are powered on at all times. When the user pushes a button, the column signal is interrupted, as the metal plate disconnects from the rest of the circuit. This allows the system to read which column is being pressed in.
The row is then read inversely. When a button is pushed, the row transitions from low to high, indicating which row was pushed. This comes back to the FPGA board in the form of a signal to the respective ROW pin, anywhere from 7 to 10.
Lastly, there is software utilized to convert these signals to the actual hexadecimal values that are meant to be portrayed by a button press.
Demonstration
Below you can find a quick video demonstrating the calculator created using the keypad, with functional 'add', 'clear', and 'equal' buttons.
Additionally, here is a still image of the wiring done in case you are looking to recreate this project!
Note that the voltage regulator to the left is unnecessary; I was using this to regulate input voltage from my 9 volt battery, as these components are not regulated to take above 3.3 Volts as input.