mikroC
making it simple...
Library Example
mikroC - C Compiler for Microchip PIC microcontrollers
The following code can be used for testing the keypad. It supports keypads with 1 to 4 rows and 1 to 4 columns. The code returned by the keypad functions (1..16) is transformed into ASCII codes [0..9,A..F]. In addition, a small
unsigned short kp, cnt;
char txt[5];
void main() { cnt = 0; Keypad_Init(&PORTC); Lcd_Init(&PORTB); Lcd_Cmd(LCD_CLEAR);
Lcd_Cmd(LCD_CURSOR_OFF);
Lcd_Out(1, 1, "Key :"); Lcd_Out(2, 1, "Times:");
do {
kp = 0;
//Initialize LCD on PORTC
//Clear display
//Cursor off
//kp = Keypad_Read(); while (!kp);
cnt++;
kp += 54; else
kp += 47;
}while (1); }//~!
MikroElektronika: Development tools - Books - Compilers
page
195