2019-01-28 04:03 AM
main.c
#include "Board_LED.h"
#include "stm32f401xe.h"
void PIN_CONFG();
void PIN_EN();
void clear();
int main(void){
LED_Initialize();
PIN_CONFG(13);
PIN_EN(13);
LED_On(0);
while(1){
}
return 0 ;
}
void delay(void){
int i ;
for(i=0;i<5000000;i++){
}
}
void EXTI15_10_IRQHandler(void){
clear(13);
LED_On(0);
delay();
LED_Off(0);
delay();
}
my interrupt functions
#include "stm32f401xe.h"
void PIN_CONFG (uint16_t pin){
EXTI ->FTSR |= (1<<pin);
}
void PIN_EN (uint16_t pin){
EXTI ->IMR |= (1<<pin);
NVIC_EnableIRQ(40);
}
void clear (uint16_t pin){
if (EXTI->PR & (1<<pin)){
EXTI->PR |=(1<<pin);
}
}
2019-01-28 04:28 AM
Argh: delay(); inside an interrupt handler! Learn the basics! And formulate a clear question.
2019-01-28 06:48 PM
that was for debugging sorry for posting it in this shape :"
the pending register bit keeps getting one without me pushing the button and doesn't clear
ignore the delay function please i have the problem with or without it
2019-01-31 11:59 AM
EXTI15_10_IRQHandler() is interrupt routine for EXTI interrupts 10-15. Maybe You are enabling some other of them also? Look at EXTI->PR register (before clearing) for which of these interrupts are actually triggered.