Datasheet
PS/2 LIBRARY
The mikroC PRO for AVR provides a library for communication with the common
PS/2 keyboard.
Note: The library does not utilize interrupts for data retrieval, and requires the oscil-
lator clock to be at least 6MHz.
Note: The pins to which a PS/2 keyboard is attached should be connected to the
pull-up resistors.
Note: 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.
External dependencies of PS/2 Library
Library Routines
- Ps2_Config
- Ps2_Key_Read
366
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6
The following variables must be
defined in all projects using
Manchester Code Library:
Description: Example:
extern sfr sbit PS2_Data;
PS/2 Data line.
sbit PS2_Data at
PINC.B0;
extern sfr sbit
PS2_In_Clock;
PS/2 Clock line in.
sbit PS2_In_Clock
at PINC.B1;
extern sfr sbit
PS2_Out_Clock;
PS/2 Clock line out.
sbit PS2_Out_Clock
at PORTC.B1;
extern sfr sbit
PS2_Data_Direction;
Direction of the PS/2
Data pin.
sbit
PS2_Data_Direction
at DDRC.B0;
extern sfr sbit
PS2_Clock_Direction;
Direction of the PS/2
Clock pin.
sbit
PS2_Clock_Direction
at DDRC.B0;