User manual

427
mikoPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
PS/2 Library
The mikroPascal PRO for dsPIC30/33 and PIC24 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:
var PS2_Data : sbit; sfr;
external;
PS/2 Data line.
var PS2_Data : sbit at RB0_bit;
var PS2_Clock : sbit; sfr;
external;
PS/2 Clock line.
var PS2_Clock : sbit at RB1_bit;
var PS2_Data_Direction : sbit;
sfr; external;
Direction of the PS/2 Data pin.
var PS2_Data_Direction : sbit at
TRISB0_bit;
var PS2_Clock_Direction : sbit;
sfr; external;
Direction of the PS/2 Clock pin.
var PS2_Clock_Direction : sbit at
TRISB1_bit;
External dependencies of PS/2 Library
Library Routines
- Ps2_Cong
- Ps2_Key_Read