Hi, How to generate an interrupt if brownout detect occurs. Using the RSIR(Reset Source Identification Register) register i can find which reset occurs. If Brownout detect occurs how to generate an interrupt??
//RSIR ----Reset Source Identification Register IC_UINT8 Brown_Out_Detect(void) { return (RSIR & 0x0F); //returns which reset occured } if(Brown_Out_Detect() == BODR_RESET) // if brownout detect occurs { VICIntSelect &= ~(1 << 20); VICVectAddr20 = (unsigned long)ISR_BOD; VICVectPriority20 = 0x14; VICIntEnable = (1 << 20); } void ISR_BOD(void) { FIO1DIR = |= (1 << LED_PIN_NO); LED_PORT_SET = (1 << LED_PIN_NO); delay(1000); LED_PORT_CLR = (1 << LED_PIN_NO); VICVectAddr20 = 0; VICIntEnClr = 0xFFFFFFFF; }
I had written the above code in the system init file to generate an interrupt if BrownOut Detect occurs, But LED is not blinking if brownout occurs
Can anyone help me how to get an interrupt if BrownOut occurs?? And where exactly i have to add this function
Thanks in Advance
yes i read the user manual
Thankyou for responding. Now i changed the code.
So why do you have
if(Brown_Out_Detect() == BODR_RESET) // if brownout detect occurs {
instead of just registering/enabling the BOD interrupt handler directly when your program starts?