thannara123
Advanced Member level 5
- Joined
- Jan 7, 2010
- Messages
- 1,602
- Helped
- 122
- Reputation
- 244
- Reaction score
- 116
- Trophy points
- 1,353
- Activity points
- 10,625
How to scan or works please anyone explain thanks in advance
Code:
uint8_t GetKeyPressed()
{
uint8_t r,c;
KEYPAD_PORT|= 0X0F;
for(c=0;c<4;c++)
{
KEYPAD_DDR&=~(0XFF);
KEYPAD_DDR|=(0X80>>c);
for(r=0;r<4;r++)
{
if(!(KEYPAD_PIN & (0X08>>r)))
{
return (r*4+c);
}
}
}
return 0XFF;//Indicate No key pressed
}
Last edited by a moderator: