gauravkothari23
Advanced Member level 2
Hi Friends,
This is Gaurav Kothari and as i am very new to electonics want a bit help from you regarding matrix keypad.
I am trying to build electronic door lock system using 89S52 and 4x4 matrix keypad and 20x2 LCD display.
The keypad does work properly with proteus. but when i build a proper circuit and tried to make an entry using my keypad, it only shows me 3 numbers (7,8 and 9). whatever keys are pressed it displays me only 7,8 or 9.
my code for keypad is:
can you please give me the solution for this problem.
- - - Updated - - -
My Circuit Diagram Is:

This is Gaurav Kothari and as i am very new to electonics want a bit help from you regarding matrix keypad.
I am trying to build electronic door lock system using 89S52 and 4x4 matrix keypad and 20x2 LCD display.
The keypad does work properly with proteus. but when i build a proper circuit and tried to make an entry using my keypad, it only shows me 3 numbers (7,8 and 9). whatever keys are pressed it displays me only 7,8 or 9.
my code for keypad is:
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 int keypad() { unsigned char dat[4][4]= { '7','8','9','%', '4','5','6','*', '1','2','3','-', 'C','0','=','+', }; unsigned char colloc,rowloc; COL=0xFF; ROW=0x00; rs=0; rw=0; en=0; busy=0; /* setting LCD screen*/ ldata=0x00; lcdcmd(0x38); lcdcmd(0x0E); lcdcmd(0x06); while(1) { /* reading character from keyboard */ do { ROW=0x00; colloc=COL; colloc&=0x0F; }while(colloc!=0x0F); do { do { msdelay(25); colloc=COL; colloc&=0x0F; }while(colloc==0x0F); msdelay(25); colloc=COL; colloc&=0x0F; }while(colloc==0x0F); while(1) { ROW=0xFE; colloc=COL; colloc&=0x0F; if(colloc!=0x0F) { rowloc=0; break; } ROW=0xFD; colloc=COL; colloc&=0x0F; if(colloc!=0x0F) { rowloc=1; break; } ROW=0xFB; colloc=COL; colloc&=0x0F; if(colloc!=0x0F) { rowloc=2; break; } ROW=0xF7; colloc=COL; colloc&=0x0F; if(colloc!=0x0F) { rowloc=3; break; } } if(colloc==0x0E) return(dat[rowloc][0]); else if(colloc==0x0D) return(dat[rowloc][1]); else if(colloc==0x0B) return(dat[rowloc][2]); else return(dat[rowloc][3]); } }
can you please give me the solution for this problem.
- - - Updated - - -
My Circuit Diagram Is:

Last edited by a moderator: