STM8S: Timer 2 with Overflow Interrupt

In previous post I showed how we can use Timer 2 as simple counter. In this post I am going to show how we can program to have interrupt when its value overflow. As simple experiment we will toggle an LED in each second within the interrupt handler (also called ISR, Interrupt Service Routine). Calculation As mentioned in previous post, default system clock frequency will be 2MHz and by default Timer 2 will also run with same frequency as system.