Neeed Coding and schematic fort a 4 x 4 keypad interfacing with PIC microcontroller

Status
Not open for further replies.

bskumar7080

Member level 2
Joined
Feb 8, 2010
Messages
48
Helped
4
Reputation
8
Reaction score
3
Trophy points
1,288
Location
India
Activity points
1,579
Hi all,

Need a schematic and coding for 4 x 4 keypad interfacing with PIC18F452 microcontroller


thanks and regards
 

i think will this will help even it use 16f77A..
what u need to know is how to connect the keypad to pic rite?
 

Attachments

  • PR9B_Schematic.pdf
    17.6 KB · Views: 162
you can call this function from the main routine to scan keypad.
No need for pull up resistors in this scheme.
Code:
int readkeypad (void)
{
 output_bit (r1, 0);
 output_bit (r2, 0);
 output_bit (r3, 0);
 output_bit (r4, 0);
 output_bit (r1, 1);//activate 1st row and scan for column
 delay_ms(10);
 IF (input (c1)) RETURN 10;
 IF (input (c2)) RETURN 0;
 IF (input (c3)) RETURN 11;
 //IF (input (c4)) RETURN 12;
 output_bit (r1, 0);//Deactivate 1st row
 output_bit (r2, 1);//activate 2nd row and scan for column
 delay_ms(10);
 IF (input (c1)) RETURN 7;
 IF (input (c2)) RETURN 8;
 IF (input (c3)) RETURN 9;
 //IF (input (c4)) RETURN 13;
 output_bit (r2, 0);//Deactivate 2nd row
 output_bit (r3, 1);//activate 3rd row and scan for column
 delay_ms(10);
 IF (input (c1)) RETURN 4;
 IF (input (c2)) RETURN 5;
 IF (input (c3)) RETURN 6;
 IF (input (c4)) RETURN 14;
 output_bit (r3, 0);//Deactivate 3rd row
 output_bit (r4, 1);//activate 4th row and scan for column
 delay_ms(10);
 IF (input (c1)) RETURN 1;
 IF (input (c2)) RETURN 2;
 IF (input (c3)) RETURN 3;
 IF (input (c4)) RETURN 15;
 output_bit (r4, 0);//Deactivate 4th row
 RETURN 255;
}
 

Attachments

  • keypad.JPG
    61.9 KB · Views: 134

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…