Hello All,
I have one function Timer_Interrupt_Init() in which I have set following registers and configure this registers to overflow timer 1. The code is as follows:-
void Timer_Interrupt_Init() { REG_GCLK_CTRLA = GCLK_GENCTRL_GENEN | GCLK_PCHCTRL_GEN_GCLK0 | GCLK_PCHCTRL_CHEN; REG_MCLK_APBAMASK |= MCLK_APBAMASK_TC1; REG_TC1_CTRLA |=TC_CTRLA_PRESCALER_DIV64; REG_TC1_CTRLA |= TC_CTRLA_ENABLE; REG_TC1_CTRLBSET |= TC_CTRLBSET_CMD_NONE; REG_TC1_COUNT16_COUNT = 0xFF45; REG_TC1_COUNT16_CCBUF0 = 0x0000; REG_TC1_COUNT16_CCBUF1= 0x0000; REG_TC1_CTRLA |= TC_CTRLA_PRESCSYNC_RESYNC; NVIC_EnableIRQ(TC1_IRQn); // Timer/Counter 1 Interrupt(s) initialization REG_TC1_INTENSET = TC_INTENSET_OVF; /*0x01;*/ }
I am calling this function in main() and after calling this function from main, insert the while(1); loop just below Timer_Interrupt_Init() function, the value gets updated to 65349 (goes red) and after that it's value doesn't get updated.
Please, help me what i am doing wrong over here in the above code for configuration of timer 1.
Thanks in advance.