100Hz. software pwm generator

On devices without hardware pwm a software pwm can be made with an interrupt timer. It is easy to extend with more outputs.

Scheme

The analog input 0..1024 is devided by 10 because of the resolution of the 100Hz generator.


Subscheme

The real pulse width generator happens at the subscheme. A counter increases with a special input symbol (timed interrupt) every 0.0001 second, 100us. The counter runs from 0 and is reset at 99. The period time is 100*100us = 10ms or 100Hz.

Simulation

The simulator can show the output with a oscilloscope.

Download

100hz.zip

Prepared for devices: ST7FLite25 PIC16F785 other devices possible by reconnecting I/O pins.