Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
PS/2 LIBRARY
The mikroPascal PRO for AVR provides a library for communication with the com-
mon 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 
314
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
The following variables
must be defined in all
projects using PS/2
Library:
Description: 
Example : 
var PS2_Data : sbit;
sfr; external;
PS/2 Data line.
var PS2_Data : sbit
at 
PINC.B0;
var PS2_In_Clock :
sbit; sfr; external;
PS/2 Clock line in.
var PS2_In_Clock :
sbit at PINC.B1;
var PS2_Out_Clock :
sbit; sfr; external;
PS/2 Clock line out.
var PS2_Out_Clock :
sbit at PORTC.B1;
var
PS2_Data_Direction :
sbit; sfr; external;
Direction of the PS/2 Data
pin.
var
PS2_Data_Direction :
sbit at DDRC.B0;
var
PS2_Clock_Direction :
sbit; sfr; external;
Direction of the PS/2
Clock pin.
var
PS2_Clock_Direction :
sbit at DDRC.B1;