[讨论] PIO0_1中断进不去?

eeleader   2010-7-12 13:43 楼主

下面是程序:

#include "..\config.h"


#define LED         (1ul << 2)
#define LED_INIT()  GPIO2DIR  |=  LED                                 /*                */
#define LEDOFF()    GPIO2DATA |=  LED                                 /*                      */
#define LEDON()     GPIO2DATA &= ~LED                                 /*                     */
#define KEY         (1ul << 1)

 

void myDelay (INT32U ulTime)
{
    INT32U i;   
    i = 0;
    while (ulTime--)
    {
        for (i = 0; i < 5000; i++);
    }
}

 

void GPIOIsr (void)
{
    GPIO0IC |= KEY;                                                   /*  清除中断标志                */
    LEDON();
 myDelay(400);
 LEDOFF();
}

int main (void)
{
    targetInit();                                                       /*  初始化目标板,切勿删除      */
    pinInit();                                                          /*  引脚初始化                  */

    SYSAHBCLKCTRL |= (1ul << 6);                                        /*  使能GPIO模块时钟            */
    LED_INIT();
    GPIO0DIR &= ~KEY;                                                   /*  设置P0.1为输入              */
   
    GPIO0IS   = 0x00;                                                   /*  P0.1为边沿中断              */
    GPIO0IEV = 0;                                                       /*  下降沿中断                  */
    GPIO0IE  |= KEY;                                                    /*  P0.1中断不屏蔽              */
  
 zyIsrSet(NVIC_PIOINT0, (unsigned long)GPIOIsr, PRIO_ONE);  
    while (1) ;
}


按照例程“GPIO_KeyInterrupt”稍微修改了下,想通过PIO0_1接的按键进入中断(按键按下时引脚为低电平),但是一直没有成功,不知道有什么问题,麻烦各路大虾帮忙分析下,谢谢!

一个为理想不懈前进的人,一个永不言败人! http://shop57496282.taobao.com/ 欢迎光临网上店铺!

回复评论

暂无评论,赶紧抢沙发吧
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复