⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 extint.c

📁 arm7s3c44b0x0里ps2口和lcd口驱动编程实例
💻 C
字号:
/*========================================================*/
//Destription: External Interrupt Test
/*========================================================*/
 
#include <string.h>
#include "\inc\define.h"
#include "\inc\drives.h"
#include "\inc\extint.h"

void __irq ExtInt4567Isr(void);
volatile char which_int=0;

/*=======================================================*/
//ExtIntInit() initialize the registers and port
/*=======================================================*/
void ExtIntInit(void)                                       
{ 
	rPCONG = 0xffff;					//EINT7~0
    rPUPG = 0x0;    
    rINTMSK &= ~BIT_EINT4567;      
    rEXTINT=0x22222222; 				//Falling edge mode        
    pISR_EINT4567=(int)ExtInt4567Isr;	    
    puts("       \nPlease press the four buttons on the board!\n       ");    
}


/*=======================================================*/
//ExtIntRpt() report the external interrupt information
/*=======================================================*/
void ExtIntRpt(void)
{
	switch(which_int)
    {
	case 1:
	    puts("EINT4 had been occured...\n");
	    which_int = 0;   
	    break;
	case 2:
	    puts("EINT5 had been occured...\n");
	    which_int = 0;   
	    break;
	case 4:
	    puts("EINT6 had been occured...\n");
	    which_int = 0;   
	    break;
	case 8:
	    puts("EINT7 had been occured...\n");
	    which_int = 0;   
	    break;	
	default :	    
	    break;
    }    
}

/*=======================================================*/
//__irq Eint4567Isr() is the ISR of external interrupt 4567
/*=======================================================*/
void __irq ExtInt4567Isr(void)
{
    which_int = rEXTINTPND;
    rEXTINTPND = 0x0f;				//clear EXTINTPND reg.		
    rI_ISPC = BIT_EINT4567;			//clear pending_bit
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -