Pwm

PWM with STM8S

PWM is a great way to control brightness of LEDs, speed of motors, etc. Most microcontrollers including STM8S has built in ability to generate PWM signals. In this article I share simple code to generate PWM signal in STM8S microcontroller. However, I don’t write anything about PWM theory other than basic calculation to get required frequency and duty cycle. Calculation In STM8S, there are total 7 CAPCOM channels. 4 of them are associated with Timer 1 and 3 with Timer 2.