Question
Interrupt cant set global variable?
Posted on March 13, 2013 at 13:22
Hi all.
I got a problem: Every time i am setting a global variable in my ISR it is set to 0 after the ISR has ended!volatile int test; void main(void){ TIM1_DeInit(); TIM1_TimeBaseInit(10, TIM1_COUNTERMODE_UP, 20000, 0); TIM1_ITConfig(TIM1_IT_UPDATE, ENABLE); TIM1_Cmd(ENABLE); /* Infinite loop */ enableInterrupts(); while (1) { test = test; } }INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11){ test = 1 ;}Test is always 1 in the ISR but always 0 in the main??.. WHY??Thanks in advance :)