Presentation is loading. Please wait.

Presentation is loading. Please wait.

Spring 2006 1 EE 316 Computer Engineering Junior Lab Designing State machines for a numeric Keypad.

Similar presentations


Presentation on theme: "Spring 2006 1 EE 316 Computer Engineering Junior Lab Designing State machines for a numeric Keypad."— Presentation transcript:

1

2 Spring 2006 1 EE 316 Computer Engineering Junior Lab Designing State machines for a numeric Keypad

3 Spring 2006 2 Topics  Designing a state machine to detect key press  PLD based design  Mealy or Moore?  Is clock frequency an issue?  Debouncing issues

4 Spring 2006 3 Keypad Hardware http://www.webopedia.com/TERM/n/numeric_keypad.html 1 1 1 1 GAL22V10 } Ready or Enable Column Scan Detection of Key press=> input to the state machine Code for Key press: Output of the State machine Clock State Machine 9 Outputs?

5 Spring 2006 4 Design alternatives  Which of the two state machines, Mealy or Moore, should we use?  Since we need 9 outputs for the state machine, 9 flip-flops are used up. Can we fit the keypad state machine on a single GAL chip?

6 Spring 2006 5 GAL22V10 Ref: Digital Design Principles & practices, John Wakerly  Max 22 inputs  Max 10 outputs  8-16 Product terms 8 Product terms for this macrocell

7 Spring 2006 6 Ref: Digital Design Principles & practices, John Wakerly State-machine structure (Mealy)  Do we need to add debouncing circuits?  Or, should we use a pipelined version of Mealy? Output can change asynchronously with the change of input.

8 Spring 2006 7 Ref: Digital Design Principles & practices, John Wakerly State-machine structure (Moore)  Do we need keypad debouncing circuits?  How many flip-flops do we need?

9 Spring 2006 8 5 V 11111111 10111011 11111111 11111111 4.7 K Key press detect Fitting the State Machine on a GAL chip 10111011 11011101 11101110 01110111

10 Spring 2006 9 State Output key code, Ready A Moore State machine One input is 0 State 1 1111/0 State 2 1111/0 State 3 1111/0 State 4 1111/0 Key detect 1 1111/0 One input is 0 1111 Key detect 2 1111/0 Key detect 3 1111/0 Key detect 4 1111/0 Resolved 1 code/1 1111 Resolved 2 code/1 Resolved 3 code/1 Resolved 4 code/1 1111 Input Key detect 1 1111/0 One input is 0 Key detect 2 1111/0 12 States? 4 or more Flipflops? Scan Key press Detect Valid Output 0111 - 7 1011 - 11 1101 - 13 1110 - 14 0011 - 3 0001 - 1 1001 - 9 1000 - 8 1100 - 12 0100 - 4 0110 - 6 0010 - 2

11 Spring 2006 10 5 V 11111111 10111011 11111111 11111111 State 1? State 2? 4.7 K State 3? State 4? Key press detect Fitting the State Machine on a GAL chip We use part of the state variables as outputs of the state machine to be used for column scan. 01110111 10111011 11011101 11101110

12 Spring 2006 11 Input/key code, Ready One input is 0/1111, 0 Key detect State 1 Key detect State 2 Key detect State 3 Key detect State 4 One input is 0/1111, 0 1111/1111, 0 A Mealy State machine 1111/1111, 0 One input is 0/code, 1 State 1 1111/0 State 2 1111/0 State 4 1111/0 State 3 1111/0 00111 - 7 01011 - 11 01101 - 13 01110 - 14 10111 – 3 11011 – 9 11101 - 12 11110 - 6

13 Spring 2006 12 How to choose the proper clock frequency  The clock frequency should be slow enough so that period is comparable to or larger than the keypad bouncing times.  The clock frequency should be fast enough so that it will be able to detect the key press even if it is released very quickly


Download ppt "Spring 2006 1 EE 316 Computer Engineering Junior Lab Designing State machines for a numeric Keypad."

Similar presentations


Ads by Google