??? 08/21/08 14:24 Read: times |
#157633 - problem in 8x8 keypad |
i have written code for 8x8 keypad. for row p1 and for column p2 is used. but sometimes i recevied wrong values. can any one suggest what is problem in code.
thanks bit debounce=1; bdata unsigned char row_no,col_no; sbit col_no0=col_no^0; void delay(unsigned int itime) { int i,j; for(i=0;i<1275;i++); for(j=0;j<itime;j++); } void col_check() { unsigned char i; for(i=0;i<8;i++) { if(col_no0==0) { break; } col_no=col_no>>1; } col_no=i; } unsigned char key_scan() { unsigned char temp,i,key=100; col=0xff; row=0x00; while(col==0xff); temp=col; delay(20); while(col==0xff); if(temp!=col) { debounce=0; } else { delay(20); temp=0xfe; for(i=0;i<8;i++) { row=_crol_(temp,i); if(col!=0xff) { col_no=col; col_check(); key=key_matrix[i][col_no]; col=0xff; while(col!=0xff); return key; } } } } void keypad_init() { col=0xff; row=0x00; debounce=1; } |
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 |