??? 07/17/06 08:29 Read: times |
#120361 - Help on understanding 4x4 matrix keypad |
I have went through all the codes which i am trying to understand, the the full source code is here (http://www.8052.com/forum/read.phtml?id=88596)
thanks to Michael Karas which is one of the senior member of this forum. However there is still one thing that i dont understand in this code and Karas has been inactive for almost over a year now :(: . . . void key_scan(void) { char col; char row; char key; for(col=0; col<4; col++) { P2=P2 | col_xlat[col]; row=P2; /* fetch in the row data */ row=(row&0x0f)^0x0f; /* keep low bits and invert */ if(row != 0) /* if a row bit set then some key */ { key=row_xlat[row]+col; /* get key code */ key=key_xlat[key]; /* translate to radio code+1 */ P2|=0xf0; . . . . Question 1: Let's say a button is pressed on button Column 2, Row 3, what is the value of P2? Is it 1011 0111? Question 2 : I understood that the the lower nibble was extracted out, inverted and then decoded to get the row value. However, i dont understand how does it detect the column number (if you have tried using manual hand calculation you would understand). I felt that something is missing to detect the appropriate column, can someone please enlightened me about this. Question 3 : Why is the column is all held to High at the end of the key scan and not including Row? |
Topic | Author | Date |
Help on understanding 4x4 matrix keypad | 01/01/70 00:00 | |
Some answers | 01/01/70 00:00 | |
Another question | 01/01/70 00:00 | |
cols | 01/01/70 00:00 | |
look at this way![]() | 01/01/70 00:00 | |
About the FF | 01/01/70 00:00 | |
one improvement | 01/01/70 00:00 |