?? main.c
字號:
#include <hidef.h> /* for EnableInterrupts macro */
#include <MC68HC908SR12.h> /* include peripheral declarations */
void main(void) {
CONFIG1 = 0x39;
DDRD = 0xF0; //PTD高四位作為輸出,低四位作為輸入
PTD &= 0x0F; //PTD高四位輸出初始值為0
KBSCR_MODEK = 1; //選擇觸發方式為下降沿和低電平
/*Initialize KeyBoard(to prevent a false interrupt)*/
KBSCR_IMASKK = 1;
KBIER = 0x0F;
KBSCR_ACKK = 1;
KBSCR_IMASKK = 0;
EnableInterrupts; /* enable interrupts */
for(;;);
}
interrupt void KBI_ISR(void)
{
KBSCR_IMASKK = 1; //屏蔽鍵盤中斷
if(PTD_PTD0==0) //在中斷服務程序中查詢是由哪一個口引起的中斷
{
PTD=0;
PTD_PTD4 = 1; //點亮指示試驗板指示燈用作驗證
}
if(PTD_PTD1==0)
{
PTD=0;
PTD_PTD5 = 1;
}
KBSCR_ACKK = 1; //清除中斷確認,避免誤中斷
KBSCR_IMASKK = 0; //不屏蔽鍵盤中斷
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -