Introduction
In this lab you will design a decoder for a 3x3 switch-
matrix numeric keypad. Your decoder will show the
binary value of the key being pressed on the FPGA
board's LEDs:
DE0-Nano
FPGA
board
4x4
switch
matrix
Requirements
All LEDs should be off if no key is being pressed.
When a key is pressed the binary value of the key
should be displayed on LED(3) through LED(0).
You need only decode the keys between 1 and 9 and
you may assume that only one key at a time will be
pressed.
Decoder Operation
e keypad contains 16 switches arranged in a 4x4
grid. We will only use the 3x3 portion consisting of
the digits 1 through 9. Each switch is connected to
one row and one column. Pressing a switch makes a
connection between the corresponding row and col-
umn conductors:
lab5.tex
ELEX 3330 : Programmable Logic Devices
2016 Winter Term
Keypad Decoder
8
LEDs
col
4
4
row
e three lemost column conductors, keypad
pins 4 through 2, are connected to FPGA inputs that
are configured with pull-up resistors so they will read
high (1) unless pulled low.
1
A simple
decoder can be designed as a state ma-
chine that cycles through three states. In each state
a different row is set low (0). Pressing a switch will
drive one of the column inputs low. If any of the
columns is low then the state machine stays in the
current state. Otherwise it goes to the next state.
a
011
a: col="111"
We can design combinational logic to obtain the
binary value of the key being pressed from the current
row and column values.
Keypad-FPGA Interface
A ribbon cable cable connects the 8 pins of the keypad
ribbon cable to 8 general purpose I/O (GPIO) pins on
the DE0-Nano FPGA board.
1
A more complete design would have to debounce the
switches and register key presses.
1
a
101
110
a
2016-05-04 23:33
Need help?
Do you have a question about the ELEX 3330 and is the answer not in the manual?
Questions and answers