Hi, I'm newbie on keil & I'm trying learn ARM Cortex-M0 from Nuvoton. I confuse how to use interrupt on timer funtion. How i can get interrupt from overflow? I'm familiar before with AVR, on atmel studio for interrupt I just call function
ISR(TIMER1_OVF_vect ) { PORTB |= _BV(0); reti(); }
And how about nuvoton? Help me please..
Thanks for your answer. what do you mean about just like normal function ? Are not work on background? I still not understand.
Most processors needs to use some magic keyword (the keyword name depends on compiler) like __irq, __interrupt or similar for interrupt handlers, to tell the compiler to add special entry/exit code to properly save/restore processor state.
But ARM has added extra hardware intelligence in the Cortex chips to make interrupts look like normal function calls. So no special entry/exit code is needed for the interrupt handlers. That also means you can use 100% C code for a Cortex-M3 chip instead of having a need for a startup file written in assembler.
Normal Function, ie no magically entry/exit requirements to save context, or return-from-interrupt
extern volatile uint32_t SystemTick; /** * @brief This function handles SysTick Handler. * @param None * @retval None */ #define TICK_RATE 1 // in milliseconds void SysTick_Handler(void) { // Free running millisecond counter for timeouts SystemTick += TICK_RATE; // 1 ms tick count }
thanks all, I understand now..