Mikroelektronika MIKROE-724 データシート

ページ / 726
428
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
PS/2 Library
The  mikroBasic  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 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 RB0_bit
dim  PS2_Clock  as  sbit  sfr 
external
PS/2 Clock line.
dim PS2_Clock as sbit at RB1_bit
dim  PS2_Data_Direction  as  sbit 
sfr external
Direction of the PS/2 Data pin.
dim  PS2_Data_Direction  as  sbit  at 
TRISB0_bit
dim PS2_Clock_Direction as sbit 
sfr external
Direction of the PS/2 Clock pin.
dim  PS2_Clock_Direction  as  sbit  at 
TRISB1_bit
External dependencies of PS/2 Library
Library Routines
 
- Ps2_Config 
 
- Ps2_Key_Read