|
我写的程序如下:
- #include "def.h"
- #include "option.h"
- #include "2440addr.h"
- #include "2440lib.h"
- static int count = 0;
- static void __irq EINT18_ISR(void)
- {
- rSRCPND |= (1<<5);
- rINTPND |= (1<<5);
-
- count++;
- Uart_Printf("count = %d\n", count);
- }
- void xmain(void)
- {
- ChangeClockDivider(3,1);
- ChangeMPllValue(127,2,1); //405MHZ
-
- Uart_Init(0, 115200);
- Uart_Select(0);
- Uart_Printf("the main is running.\n");
- //-----------------中断初始化----------------//
- //选择功能管脚
- rGPGCON = ( rGPGCON | (3<<20) & ( ~(1<<20)) );//EINT18 -> GPG10
- //中断模式
- rINTMOD = rINTMOD & ( ~(1<<5) );//EINT18 IRQ mode
- //触发方式
- rEXTINT2 = ( rEXTINT2 | (7<<8) ) & ( ~(5<<8) );//EINT18 falling edge triggered
- //使能中断
- rINTMSK = rINTMSK & ( ~(1<<5) );//EINT18 interrupt service available
- rEINTMASK = rEINTMASK & (~(1<<18));
- //清中断
- rSRCPND |= (1<<5);//to clear EINT18
- rINTPND |= (1<<5);//
- //中断向量
- pISR_EINT8_23 = (U32)EINT18_ISR;//EINT18
- while(1)
- {
- }
- }
复制代码
程序运行后对外部中断没有相应,这是为什么呢?
|
|