当前位置: 代码迷 >> 驱动开发 >> 请帮忙分析一下小弟我写的一段s3c44b0的中断代码
  详细解决方案

请帮忙分析一下小弟我写的一段s3c44b0的中断代码

热度:85   发布时间:2016-04-28 11:11:47.0
请大虾帮忙分析一下我写的一段s3c44b0的中断代码
我打算通过按键触发中断Extint456,接收到中断后,将板上的led1或led2点亮,并且在超级终端输出“Press   Key0~3first”,但是试验结果却是led3被点亮,并且超级终端上不停的输出“Press   Key0~3first”。我的超级中断输出是采用查询方式,未用fifo。停止在线调试的时候,我看到程序是运行到Delay()函数。
请各位大虾指点一二。不胜感谢!

#include   "option.h "
#include   "def.h "
#include   "44b.h "
#include   "44blib.h "

static   int   zz=0;
  void   __irq   Ext_Int()
  {
  zz++;
  if(zz%2)
      Led_Display(1);
      else
      Led_Display(2);
      Delay(10);
      Uart_Printf( "Press   Key0~3first ");
//   Delay(1000);
  }


void   initial_extint(void)
  {
  rINTCON=0x5;
  rINTMOD=0x0;
  rEXTINT=0x22222222;
  rPCONG=0xffff;   //EINT7~0
        rPUPG=0x0;     //pull   up   enable
  rINTMSK=~(BIT_GLOBAL|BIT_EINT4567);
 
 
  pISR_EINT4567=(int)Ext_Int;
 
  Uart_Printf( "Press   Key0~3second ");
  // Delay(1000);
 
 
 
  }

void   Main(void)
{
        U8   aa;
       
        rSYSCFG=CACHECFG;       //   Using   8KB   Cache//

        Port_Init();
        Beep(0);
//         Led_Display(0x0);

        Uart_Init(0,57600);
        Delay(10);
        Uart_Select(0);   //Select   UART0


      initial_extint();
      while(1);
}


------解决方案--------------------
中断标志用软件清除吗??
------解决方案--------------------
1.没有清除中断;
2.不建议在中断服务程序里面用delay函数。

------解决方案--------------------
你打印的是变量的地址(0x0C400008),不是你的变量。