mikroC

making it simple...

PS/2 Library

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC provides a library for communicating with common PS/2 keyboard.The library does not utilize interrupts for data retrieval, and requires oscillator clock to be 6MHz and above.

Library Routines

Ps2_Init

Ps2_Config

Ps2_Key_Read

Ps2_Init

Prototype

void Ps2_Init(unsigned short *port);

Description Initializes port for work with PS/2 keyboard, with default pin settings. Port pin 0 is Data line, and port pin 1 is Clock line.

You need to call either Ps2_Init or Ps2_Config before using other routines of PS/2 library.

Requires Both Data and Clock lines need to be in pull-up mode.

Ps2_Config

Prototype

void Ps2_Config(char *port, char clock, char data);

Description Initializes port for work with PS/2 keyboard, with custom pin settings. Parameters data and clock specify pins of port for Data line and Clock line, respectively. Data and clock need to be in range 0..7 and cannot point to the same pin.

You need to call either Ps2_Init or Ps2_Config before using other routines of PS/2 library.

Requires Both Data and Clock lines need to be in pull-up mode.

Example

Ps2_Config(&PORTB, 2, 3);

 

 

page

 

MikroElektronika: Development tools - Books - Compilers

237