Presentation is loading. Please wait.

Presentation is loading. Please wait.

Keypad Source: http://www.edsim51.com/8051Notes/interfacing.html#keypad under http://www.edsim51.com/8051Notes/interfacing.html under http://www.edsim51.com/8051Notes/index.html.

Similar presentations


Presentation on theme: "Keypad Source: http://www.edsim51.com/8051Notes/interfacing.html#keypad under http://www.edsim51.com/8051Notes/interfacing.html under http://www.edsim51.com/8051Notes/index.html."— Presentation transcript:

1 Keypad Source: under under

2 4 X 4 keypad The keypad is a matrix of switches.
In the default state (all switches open), there is no connection between the rows and columns. When a switch is pressed, a connection between the switch's row and the switch's column is made.

3 Hardware Decoder for Keypad
The decoder scans the keypad. When a key is pressed, the 4-bit code for the key appears on the four output lines and the data available line (DA) goes LOW. The microcontroller will be interrupted by DA. The ISR could then read the 4 LSBs of P1 and process the data. Key pressed O1~O4 DA (Data available)

4 Software Decoder for Keypad
Scanning a row is achieved by applying 0 V to the port pin for that row and 5 V to the other three rows, then scanning each individual column to see if one of them is LOW. If it is, then the key at the junction between the current row and column being scanned is the pressed key. Sequence of scanning: Clear row 1, set other 3 Scan column 1 Scan column 2 Scan column 3 Scan column 4 Clear row 2, set other 3 Clear row 3, set other 3 Clear row 4, set other 3

5 No key is pressed: A key is pressed:
Sequence of scanning: Clear row 0, set other 3 Scan column 0 Scan column 1 Scan column 2 Scan column 3 Clear row 1, set other 3 Clear row 2, set other 3 Clear row 3, set other 3 Col Col Col Col. 0 Row 3 Row 2 Row 1 Row 0 1 Col Col Col Col. 0 Row 3 Row 2 Row 1 Row 0 1

6 Key numbers in edsim51 Key numbers

7 Keypad connection in edsim51
8051 Resistor AND gate Col. 3 Col. 2 P0.6 Pull up AND in Col. 1 P0.5 Col. 0 P0.4 Row 3 P0.0 Row 2 P0.1 Row 1 P0.2 Row 0 P0.3

8 Finding the pressed key: row scan & col. scan
Check Row 3 P0[3:0] = 0111 Check P0[6:4] P0[6:4] = 011 P0[6:4] = 101 P0[6:4] = 110 “1” “2” “3” Check Row 2 P0[3:0] = 1011 “4” “5” “6” Check Row 1 P0[3:0] = 1101 “7” “8” “9” Check Row 0 P0[3:0] = 1110 “*” “0” “#”

9 -


Download ppt "Keypad Source: http://www.edsim51.com/8051Notes/interfacing.html#keypad under http://www.edsim51.com/8051Notes/interfacing.html under http://www.edsim51.com/8051Notes/index.html."

Similar presentations


Ads by Google