?? kbd.c
字號:
#include <Atmel/at89c5131.h>
#include "kbd.h"
#include "lcd.h"
unsigned char KeyPressed;
unsigned char KeyCode;
//-----------------------------------------------------
void EnableKbd()
{
IEN1 |= 0x01; /* Enable keyboard interupt */
}
//-----------------------------------------------------
void DisableKbd()
{
IEN1 &= 0xFE; /* Disable keyboard interupt */
}
//-----------------------------------------------------
void InitKbd()
{
KeyPressed = 0;
KeyCode = 0;
EA = 1; /* enable interrupts */
KBE = 0x1F; /*Enable P1 I/O as keyboard IO */
KBF = 0x00; /* Clear all keyboard flags */
IEN1 |= 0x01; /* Enable keyboard interupt */
}
//-----------------------------------------------------
unsigned char GetKey()
{
while(!KeyPressed){}
KeyPressed = 0;
return KeyCode;
}
//-----------------------------------------------------
/**
* FUNCTION_PURPOSE:keyboard_interrupt. Save pressed key
* FUNCTION_INPUTS:void
* FUNCTION_OUTPUTS:void
*/
void keyboard_interrupt() interrupt 7 using 1
{
//IEN1 &=0xFE; /* Disable keyboard interupt */
EA = 0;
KeyCode = KBF&0x1F; /* save pressed key */
KeyPressed = 1; /* set the software flag */
KBF = 0x00; /* clear keyboard flags */
//IEN1 |=0x01; /* Enable keyboard interupt */
EA = 1;
}
//-------------------------------------------------------------------
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -