主题 : 外部中断 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 5489
精华: 0
发帖: 27
金钱: 280 两
威望: 280 点
综合积分: 54 分
注册时间: 2009-04-25
最后登录: 2009-10-23
楼主  发表于: 2009-05-15 18:26

 外部中断

static void __irq Key_ISR(void)
{
    U8 key;
    U32 r;
    EnterCritical(&r);
    if(rINTPND==BIT_EINT8_23) {
        ClearPending(BIT_EINT8_23);
        if(rEINTPEND&(1<<8)) {
        //Uart_Printf("eint11\n");
            rEINTPEND |= 1<< 8;
        }
        if(rEINTPEND&(1<<11)) {
        //Uart_Printf("eint11\n");
            rEINTPEND |= 1<< 11;
        }
        if(rEINTPEND&(1<<13)) {
        //Uart_Printf("eint11\n");
            rEINTPEND |= 1<< 13;
        }
        if(rEINTPEND&(1<<14)) {
        //Uart_Printf("eint11\n");
            rEINTPEND |= 1<< 14;
        }
        if(rEINTPEND&(1<<15)) {
        //Uart_Printf("eint11\n");
            rEINTPEND |= 1<< 15;
        }
        if(rEINTPEND&(1<<19)) {
        //    Uart_Printf("eint19\n");        
            rEINTPEND |= 1<< 19;
        }
    }

    key=Key_Scan();
    if( key == 0xff )
        Uart_Printf( "Interrupt occur... Key is released!\n") ;
    else
        Uart_Printf( "Interrupt occur... K%d is pressed!\n", key) ;

    ExitCritical(&r);
}
这是2440test中keyscan.c中的函数第六行if(rEINTPEND&(1<<8)) {
        //Uart_Printf("eint11\n");
            rEINTPEND |= 1<< 8;
        }
这句话是什么意思啊
级别: 新手上路
UID: 3065
精华: 0
发帖: 13
金钱: 130 两
威望: 120 点
综合积分: 26 分
注册时间: 2008-12-25
最后登录: 2010-09-25
1楼  发表于: 2009-06-28 20:58
由于EINT_8~EINT_23是共享中断,在ISR(中断服务程序中)通过  rEINTPEND 来区分。并且在中断完成以后,rEINTPEND 相应位要写1来清除。