??? 08/26/08 18:25 Read: times |
#157777 - code of 8x8 keypad Responding to: ???'s previous message |
i have put 1k pull up on p1
#define col P2 #define row p1 code unsigned char key_matrix[8][8] = { 43, 42, 41, 40, 39,38, 37, 36, 66, 59, 64, 63, 62, 61, 45, 44,7,6,5,4,3,2,1,0,18, 17, 16, 15, 14, 13, 12, 11,57, 56, 55, 10, 9, 8, 20, 19,54, 53, 52, 25, 24, 23, 22, 51, 50, 49, 30, 29, 28, 27, 26, 58, 47, 48, 65, 60, 67, 32, 31,}; void MSDelay(unsigned int value) { unsigned int x,y; for(x=0;x<1275;x++) for(y=0;y<value;y++); } xdata unsigned char colloc,rowloc,temp=0xfe,i=0; unsigned char key_scan() { col=0xff; while(1) { do { row=0x00; colloc=col; }while(colloc!=0xff);//check untill all key release do { do { MSDelay(20); colloc=col; }while(colloc==0xff); MSDelay(5); colloc=col; }while(colloc==0xff); while(1) { row=_crol_(temp,i); colloc=col; if(colloc!=0xff) { rowloc=i; i=0; break; } i++; } //check cloumn // if(colloc==0xfe) { key=key_matrix[rowloc][0]; return key; }else if(colloc==0xfd) { key=key_matrix[rowloc][1]; return key; }else if(colloc==0xfb) { key=key_matrix[rowloc][2]; return key; }else if(colloc==0xf7) { key=key_matrix[rowloc][3]; return key; }else if(colloc==0xef) { key=key_matrix[rowloc][4]; return key; }else if(colloc==0xdf) { key=key_matrix[rowloc][5]; return key; } else if(colloc==0xbf) { key=key_matrix[rowloc][6]; return key; } else if(colloc==0x7f) { key=key_matrix[rowloc][7]; return key; } } } ...replace this with your code... |
Topic | Author | Date |
problem in 8x8 keypad | 01/01/70 00:00 | |
I see ... | 01/01/70 00:00 | |
this code with correction | 01/01/70 00:00 | |
Try the Insert Code button. | 01/01/70 00:00 | |
code with comment | 01/01/70 00:00 | |
Lots of things to look into | 01/01/70 00:00 | |
reply | 01/01/70 00:00 | |
One way to debounce | 01/01/70 00:00 | |
One Suggestion | 01/01/70 00:00 | |
the easy way to do keypads | 01/01/70 00:00 | |
indent, indent, indent | 01/01/70 00:00 | |
problem in keypad | 01/01/70 00:00 | |
Where is the code? | 01/01/70 00:00 | |
code of 8x8 keypad | 01/01/70 00:00 | |
Simplify and think about debounce![]() | 01/01/70 00:00 |