2019-01-15 08:13 AM
Hi all,
I have a issue about interrupt timer and interrupt button. When i alway press button. Run debug, cursor alway run to interrupt exti line. I change timer 2,4 or pin exti still error occur. When I comment TIM1_Config() i alway press button-->interrupt button is ok. I use STM8S003F3, IDE IAR. Please help me! Thanks. Below code:
void EXTI_Config(void){
GPIO_Init(GPIOB, (GPIO_Pin_TypeDef)GPIO_PIN_4, GPIO_MODE_IN_PU_IT);
EXTI_SetExtIntSensitivity(EXTI_PORT_GPIOB, EXTI_SENSITIVITY_FALL_ONLY);
enableInterrupts();
}
----------------------------------------------------------------------------------------------
void TIM1_Config(void){
CLK_PeripheralClockConfig (CLK_PERIPHERAL_TIMER1 , ENABLE);
TIM1_DeInit();
TIM1_TimeBaseInit(7999, TIM1_COUNTERMODE_UP, 1999, 0);//interrupt 1s
TIM1_ARRPreloadConfig(ENABLE);
TIM1_ITConfig(TIM1_IT_UPDATE, ENABLE);
TIM1_ClearITPendingBit(TIM1_IT_UPDATE);
TIM1_Cmd(ENABLE);
enableInterrupts();
}
----------------------------------------------------------------------------------------------
INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11){
count++;
TIM1_ClearITPendingBit(TIM1_IT_UPDATE);
}
----------------------------------------------------------------------------------------------
INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4){
if(GPIO_ReadInputPin(GPIOB,GPIO_PIN_4)==0) flag=~flag;
}
2019-01-15 08:38 PM
What exactly is needed functionality? This is order to step back from the chosen implementation.
2019-01-15 10:21 PM
Thanks your relay! I want when click button. EXTI occur flag=flag^1. Timer TIM1 interrupt after 1s, varible count++. But when I hole button. EXTI occur continuos and flag=flag^1,flag=flag^1,......