Timers inside MCUs are very useful and essential peripherals for timing applications. In this article I will show Timer 2 in an STM8S (specifically STM8S103F3) can be used to blink an LED. Calculation STM8S has an internal oscillator with 16MHz frequency. By default it will be used as system clock source with prescaler 8, which means system clock frequency will be 16MHz/8 = 2MHz. By default Timer 2 will run with same frequency as system.