Student ApplicationNotes for Tetris Group

Name : Feng Gui

Introduction:

 The keypad we have used is 4X4 series 83 keypad, which has 4 columns and 4 rows. In our design, we use 4 columns as drives lines to drive 4 series of 4 bit data into the keypad and 4 rows as senses lines to output the data into the FPGA. This diagram is shown below.

 In our keypad decoder file, we define those columns as drive lines and rows as sense lines. Both rows and columns have 4 lines, and each of the 4-sense line is connected to voltage source with 4.7k ohm. So the original data for rows will be as high as "zzzz" without any keys being pressed. The drive lines drive 4 different 4 bits input data which one bit will be low and the other three bits will be high such as "0zzz" into the keypad. Those 4 inputs will be "0zzz", "z0zz", "zz0z" and "zzz0". Once the sense lines sense a ‘0’, then we know that a key is pressed. The reason of ‘0’ appears is a line in the keypad is shorted to cause row bit value low. From the index number of column which has ‘0’ value and the index number of row which has ‘0’ value, we can detect out which key is pressed according to our decoder file design. Then the key output data is sent out and the key will be released to continue operation. That is the way of keypad operating.

 The following is the diagram (keypad.gif) about connection of the key and the FPGA chip.

 

 

 

Debouncing:

The most difficulty in the keypad decoder design is the debouncing. If the debouncing is not dealt properly, there would be not input into the keypad decoder and no output to FPGA. Then the keypad won'’t work. From my experience, the debouncing will work in the time interval between 1ms – to 10ms. So I pick 1ms for my debouncing period. Since the clock I will use in the Altera EPF10k20 board is 25.175 MHz. In order to have 1ms, I use counter to count up to 25175 times. I am sure that signal will be stable enough in that period to send out.

 Displayer:

The purpose of the displayer file is to display the keypad output on the Flex-digital display so that I have chance to figure out whether the right button is pressed from the display segment on the display. I can have 4-bit output from the keypad decoder and convert it into 7-bit output from the display file so that output can be displayed on the digital 7-segment display connected directly to the EPF10K20 device. Since I may have 15 different 4-bit output from the keypad decoder, I assign 15 different 7-bit output for converting.

 Keytop:

The purpose of the keytop is to connect those 3 components together and work as one piece file so that I can run the whole file into the EPF10k20 chip to test the keypad. The input of keytop is the input of debouncing and the output is the output of displayer.

 The following diagram (keytop.gif) is for the keytop:

 

 

 

 

 



 


 

 






















 

 

 

 

 

.