AnsweredAssumed Answered

How can I clear the status bit when I got into an interrupt?

Question asked by nigong on Oct 24, 2011
Latest reply on Oct 25, 2011 by Nabeel

Hi all,

 

When I press PF8 button, I want the blackfin goes into a ISR and the counter increases 1.

I should clear or set a bit which indicates the processor has entered the ISR, but I don't know how to clear it.

 

Here is my code:

#include<stdio.h>
#include<cdefbf533.h>
#include<sys\exception.h> // needed for interrupts
 
// 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
}

BTW, my processor is BF533.

Thanks,

Ashley

Outcomes