Re: keypad
hi, I'm sending a PICC code to you... It was originally written for PIC 16f877
But definitely you can get an idea about how to interface a keypad.
Sorry for not applying comments. I think you can understand it without a problem.
A simple code.
cya
Randika K
// reads the keypad and returns a charater
char kbd_read(){
delay_ms(120);
//delay_ms(1);
output_b(0b00001100);
if(!input(PIN_B4)){
return '1';
} else if(!input(PIN_B5)){
return '4';
} else if(!input(PIN_B6)){
return '7';
} else if(!input(PIN_B7)){
return '+';
}
output_b(0b00001010);
if(!input(PIN_B4)){
return '2';
} else if(!input(PIN_B5)){
return '5';
} else if(!input(PIN_B6)){
return '8';
} else if(!input(PIN_B7)){
return '0';
}
output_b(0b00000110);
if(!input(PIN_B4)){
return '3';
} else if(!input(PIN_B5)){
return '6';
} else if(!input(PIN_B6)){
return '9';
} else if(!input(PIN_B7)){
return '#';
} else {
return '+';
}
}