Keypad Scanning interface - PowerPoint PPT Presentation

About This Presentation
Title:

Keypad Scanning interface

Description:

Infineon 167 Target board connections Keypad Scanning interface Used for interfacing push-button(momentary) switches Used for large number(8) ... – PowerPoint PPT presentation

Number of Views:45
Avg rating:3.0/5.0
Slides: 4
Provided by: AlanG75
Category:

less

Transcript and Presenter's Notes

Title: Keypad Scanning interface


1
Keypad Scanning interface
  • Used for interfacing push-button(momentary)
    switches
  • Used for large number(gt8) push-buttons
  • Relies on matrix arrangement of push-buttons

PORT
1
3
2
F
6
E
5
4
1
ROWS Inputs
8
9
D
7
C
0
A
B
COLUMNS Outputs
2
Infineon 167 Target board connections
BASIC APPROACH TO SCANNING Set port direction
bits 4-7 I/p, bits 0-3 o/p. Initial column_scan
00001000 0x08 next column_scan value 00000100
then 00000010 and finally 00000001 Use 'C' gtgt
operator which shift bits of an integer to the
right At each stage read in all rows and if
rows are non zero then find which of the four
bits is a '1'
Port 8
3
static char keypad_scan(void) const char
key_code "FEDC369B2580147A" // keypad
layout unsigned char row, row_scan, column,
column_scan column_scan 0x08
for(column 0 column lt 4 column)
P8 column_scan // Activate column
row_scan P8 gtgt 4 if(row_scan ! 0)
// Any key pressed? row
0 //Find which bit in row
while((row_scan 2) 0) // test least
significant bit
row row_scan gtgt 1
return(key_codecolumn 4
row) // return key code // end if
column_scan gtgt 1 //ready for next
column // end for return 0 // No key
pressed
Write a Comment
User Comments (0)
About PowerShow.com