mikroC
making it simple...
Library Example
This simple example reads values of keys pressed on PS/2 keyboard and sends them via USART.
unsigned short keydata, special, down;
void main() {
CMCON
= 0x07;
INTCON = 0;
Ps2_Init(&PORTA); // Init PS/2 Keyboard on PORTA
Delay_ms(100);
do {
if (Ps2_Key_Read(&keydata, &special, &down)) {
if (down && (keydata == 16)) { // Backspace
// ...do something with a backspace...
}
else if (down && (keydata == 13)) { // Enter
Usart_Write(13);
}
else if (down && !special && keydata) {
Usart_Write(keydata);
}
}
Delay_ms(10);
} while (1);
} //~!
MikroElektronika: Development tools - Books - Compilers
mikroC - C Compiler for Microchip PIC microcontrollers
// Disable analog comparators (comment this for PIC18)
// Disable all interrupts
// Wait for keyboard to finish
// debounce
page
239
Need help?
Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?