User manual

Table Of Contents
396
mikoC PRO for PIC32
MikroElektronika
PS/2 Library
The mikroC PRO for PIC32 provides a library for communication with the common PS/2 keyboard.
Important:
- The library does not utilize interrupts for data retrieval, and requires the oscillator clock to be at least 6MHz.
- The pins to which a PS/2 keyboard is attached should be connected to the pull-up resistors.
- Although PS/2 is a two-way communication bus, this library does not provide MCU-to-keyboard communication; e.g.
pressing the Caps Lock key will not turn on the Caps Lock LED.
The following variables must be dened
in all projects using PS/2 Library:
Description: Example:
extern sfr sbit PS2_Data;
PS/2 Data line.
sbit PS2_Data at RB0_bit;
extern sfr sbit PS2_Clock;
PS/2 Clock line.
sbit PS2_Clock at RB1_bit;
extern sfr sbit PS2_Data_
Direction;
Direction of the PS/2 Data pin.
sbit PS2_Data_Direction at TRISB0_
bit;
extern sfr sbit PS2_Clock_
Direction;
Direction of the PS/2 Clock pin.
sbit PS2_Clock_Direction at TRISB1_
bit;
External dependencies of PS/2 Library
Library Routines
- Ps2_Cong
- Ps2_Key_Read