I need to generate pulse trains using a ATmega328 or similar - I have made up some carrier boards so I can play with these on a breadboard. Frequency is quite low - basic requirements are
- mark: 20uS - 100mS (20uS to 1mS, 1mS steps thereafter)
- space: 1mS - 10S (1mS steps to 100mS, 10mS steps to 1S, 100mS steps thereafter)
Precision is not at the top of the list. Should I do this my fiddling with the timer settings, or have a free-running timer with reasonably fine granularity and toggle a bit as required? I'll be adjusting either the mark or space using a rotary encoder.
The maths for this sort of thing should be pretty straight forward, and I would have thought that there would be example GCC code out there, but I could not locate any...
Thanks for any input you can provide...