📄 main.c
字号:
#include <string.h>
#include "..\inc\option.h"
#include "..\inc\DEF.H"
#include "..\inc\44b.h"
#include "..\inc\44blib.h"
#include "..\inc\lcd.h"
#include <stdio.h>
#define Clr_PendingBit(n) rI_ISPC |= (1<<(n))
#define Set_rINTMSK(n) rINTMSK |= (1<<(n))
#define CLR_rINTMSK(n) rINTMSK &= (~(1<<(n)))
#define SET_F(n) rPDATF |= (1<<(n))
#define CLR_F(n) rPDATF &= (~(1<<(n)))
int j=-1,i=1;
extern const INT8U aucTempBitmap[][76800];
void __irq EXINT0(void)
{
Clr_PendingBit(25);
Set_rINTMSK(25);
Clr_PendingBit(25); //disable the eint 0
//Uart_Printf("\n the EXINT0 is runing!\n");
j=0;
return;
}
void __irq EXINT1(void)
{
Clr_PendingBit(24);
Set_rINTMSK(24);
Clr_PendingBit(24); //disable the eint 1
//Uart_Printf("\n the EXINT1 is runing!\n");
j=1;
return;
}
void __irq EXINT2(void)
{
Clr_PendingBit(23);
Set_rINTMSK(23);
Clr_PendingBit(23); //disable the eint 2
//Uart_Printf("\n the EXINT2 is runing!\n");
j=2;
return;
}
void __irq EXINT3(void)
{
Clr_PendingBit(22);
Set_rINTMSK(22);
Clr_PendingBit(22); //disable the eint 3
//Uart_Printf("\n the EXINT3 is runing!\n");
j=3;
return;
}
void isr_init(void)
{
rEXTINT=0x22222222; //follow trig
rINTCON=0x5; // Non-ectored,IRQ enable,FIQ disable
rINTMOD=0x0; // All=IRQ mode
rINTMSK=0x7ffffff; // All interrupt is masked
pISR_EINT0=(unsigned)EXINT0;
pISR_EINT1=(unsigned)EXINT1;
pISR_EINT2=(unsigned)EXINT2;
pISR_EINT3=(unsigned)EXINT3;
}
void Main(void)
{
rSYSCFG=CACHECFG; // Using 8KB Cache//
Port_Init();
Uart_Init(0,115200);
Led_Display(0xf);
Delay(0);
isr_init();
Lcd_Init();
Uart_Printf("\n Iinitial successfully!\n");
rINTMSK=0x03fffff; //enable the exint 0 1 2 3!!
Uart_Printf("\n Please press the key!\n");
while(1)
{
while(j==-1)
{
for(i=1;i<5;i++)
{
CLR_F(i);
Delay(250);
SET_F(i);
if(j!=-1) break;
//Uart_Printf("\n i is %d\n",i);
}
}
while(j!=-1)
{
Uart_Printf("\n Some body has press the key!!\n");
if(j==0)
{
Uart_Printf("\n It is the key k%d\n",(i-1)*4+j);
Delay(500);
Lcd_Clr();
Lcd_Draw_Box(0x00e0,0x0030,0x0100,0x0010,0x0f);
//////////////////
///////////end////
//////////////////
j=-1;
Clr_PendingBit(25);
CLR_rINTMSK(25);
//SET_F(i);
break;
}
if(j==1)
{
Uart_Printf("\n It is the key k%d\n",(i-1)*4+j);
Delay(500);
Lcd_Clr();
Lcd_Draw_Box(0x00e0,0x0030,0x0100,0x0010,0xe0);
///////////////////////
//////end//////////////
///////////////////////
j=-1;
Clr_PendingBit(24);
CLR_rINTMSK(24);
//SET_F(i);
break;
}
if(j==2)
{
Uart_Printf("\n It is the key k%d\n",(i-1)*4+j);
Delay(500);
Lcd_Clr();
Lcd_Draw_Box(0x00e0,0x0030,0x0100,0x0010,0x01);
//////////////////
/////end//////////
//////////////////
j=-1;
Clr_PendingBit(23);
CLR_rINTMSK(23);
//SET_F(i);
break;
}
if(j==3)
{
Uart_Printf("\n It is the key k%d\n",(i-1)*4+j);
Delay(500);
Lcd_Clr();
Lcd_Draw_Box(0x00e0,0x0030,0x0100,0x0010,0x7f);
//////////////////
/////end//////////
//////////////////
j=-1;
Clr_PendingBit(22);
CLR_rINTMSK(22);
//SET_F(i);
break;
}
};
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -