ADI BF533可编程标志中断

时间:2011-10-24 22:14:18

标签: embedded interrupt

当我按下PF8按钮时,我希望blackfin进入ISR并且计数器增加1。 我应该清除或设置一个表示处理器已进入ISR的位,但我不知道如何清除它。

我的处理器是BF533。

这是我的代码:

    // prototype
EX_INTERRUPT_HANDLER(FlagA_ISR);

volatile int count = 0;

void main(void)
{

     // Register FlagA ISR to interrupt vector group 12
     register_handler(ik_ivg12, FlagA_ISR);

     // set direction of programmable flag PF8 to input
     *pFIO_DIR &= ~PF8;
     ssync();

     // interrupt enable PF8
     *pFIO_INEN |= PF8;
     ssync();     

     // give interrupt when FIO_FLAG_D PF8 changes
     *pFIO_MASKA_D |= PF8;
     ssync();


     // Bind FlagA interrupt to IVG12
     *pSIC_IAR2 |= 0x00005000; // flag A IVG12
     ssync();


     // Enable PFA in system interrupt mask register
     *pSIC_IMASK = 0x00080000;
     ssync();

     // enable IVG12 in core interrupt mask register
     *pIMASK |= 0x00001000;
     ssync();

     // wait for interrupt
     while(count < 5);
        printf("5 interrupts received");
}

EX_INTERRUPT_HANDLER(FlagA_ISR)
{     
     count++;

     // Needed to clear or set a bit to indicate that the processor has entered the ISR
}

1 个答案:

答案 0 :(得分:1)

我刚刚想出如何解决这个问题。

PFx连接到FIO_FLAG。我们可以通过清除FIO_FLAG清除我们的中断状态。

以下是代码:

*pFIO_FLAG_D &= ~PF8;
ssync();
//or, you can try:
*pFIO_FLAG_C |= PF8; 
ssync();