Interfacing 4x4 matrix keypad with 8051 microcontroller and 7segment display.Download contains the source code with proteus simulation file.
Sponsored Links
Circuit Diagram
C codeCode (C):
#include <reg51.h> #include <stdio.h> #define byte unsigned char //Interrupt service routine void keyinterrupt() interrupt 2 { int t; byte keycode,scancode,flag=0xff; t=5000; while(t--); if(INT1==1) return; EX1=0; scancode=0xef; while(scancode!=0xff) { P1=scancode; keycode=P1; if((keycode&0x0f)!=0x0f) break; scancode=(keycode<<1)|0x0f; } keycode=~keycode; P2=keycode; //Will scan the code output, digital control with digital control functions with the decoding P1=0X0F; while(1) { if(INT1==1) { flag=~flag; if(flag==0) break; } t=10000; while(t--); } EX1=1; return; } void main(void) { IE=0; EX1=1; EA=1; //Break open P2=0XFF; P1=0X0F; while(1) { } }
8051 4x4 keypad interface with 7segment display 1.0
Interfacing 4x4 matrix keypad with 8051 microcontroller and 7segment display.