Hello, i was wondering if anyone could help me, to get my 4x4 keypad scanning function working. Its supposed to drive each column to zero one at a time and then poll each row in sequence for zeros.
unsigned int scan_key (void) {
int col;
int key_read;
///////////
for(col=0;col++;col=3 ) { ////Go through columns
///////////////////////////////////////////// (GPIO_PORTD_DATA )&=~(0x1<<col);
if (!(GPIO_PORTC_DATA & 0x10)==0)//Polling row0
{ key_read=keypad [0][col]; break; }
///////////////////////////////////////////////// /////////////////////////////////////
if (!(GPIO_PORTC_DATA & 0x20)==0)//Polling row1
{ key_read=keypad[1][col]; break; }
//////////////////////////////////////////////////
if (!(GPIO_PORTC_DATA & 0x40)==0)//Polling row2
{ key_read=keypad[2][col]; break; }
/////////////////////////////////////////////////////////
if (!(GPIO_PORTC_DATA & 0x80)==0)//Polling row3
{ key_read=keypad[3][col]; break; }
} return key_read; }
1) Did you happen to forgot to read the posting instructions?
2) Did your post end up looking like you intended?
3) Did you try the magic of debugging - like looking closer at your row and column signals for the four iterations? Did you really get the intended result on PORTD? You are only intended to clear bits - never set any bits?
4) What did you intend to return if no key is pressed? Or didn't you debug that alternative?
5) What did you intend to return if multiple keys are pressed? Or didn't you debug that alternative?
i was wondering if anyone could help me.... Dont you think that no one will bother to read a code in the format that you have pasted?? its such a mess.
by the way, what is the amount of bugs that you are ready to spend for the help you get? (do you really want to learn to write a code or you want the code right-away?)
amount of bugs amount of bucks* (money)
The guy doesnt even have time to watch preview before posting.
Note that the preview - at least earlier - doesn't use to show the full degree of the mess of source code posted without tags.
The preview is only perfect if it has identically same styling and the text has had identically same processing.
@Per, was talking about 'Dont have time'. the guy doesnt even have time to check the preview and correct typos/ spellings.
thee guy doesnt even have time to check the preview and correct typos/ spellings.
Heez not a loan with fat wun.