Mikroelektronika MIKROE-350 Fiche De Données

Page de 526
PS/2 LIBRARY
The mikroBasic 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 
302
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
The following variables
must be defined in all
projects using PS/2
Library:
Description: 
Example : 
dim PS2_Data as sbit
sfr external
PS/2 Data line.
dim PS2_Data as sbit
at 
PINC.B0
dim PS2_In_Clock as
sbit sfr external
PS/2 Clock line in.
dim PS2_In_Clock as
sbit at 
PINC.B1
dim PS2_Out_Clock as
sbit sfr external
PS/2 Clock line out.
dim PS2_Out_Clock as
sbit at 
PORTC.B0
dim
PS2_Data_Direction 
as
sbit sfr external
Direction of the PS/2 Data
pin.
dim
PS2_Data_Direction 
as
sbit at DDRC.B0
dim
PS2_Clock_Direction
as sbit sfr external
Direction of the PS/2
Clock pin.
dim
PS2_Clock_Direction
as sbit at DDRC.B1