[Solved] Increasing PWM frequency and resolution

liudr:
Sorry for lingering here beyond the [Solved] word but I thought this library provides a way to manipulate timer1 for PWM (arbitrary period and 10bit):

Arduino Playground - HomePage

I am myself just starting with this so don't know too much about it.

Hi!

I came across this library yesterday, and at the time of reading, I just couldn't make sense of the example, so I decided not to use it. But it makes sense to me now, and seems to be a slightly nicer way of what Mr. Gammon did. :smiley:

However, in the last hour I've realised something awful... with 10-bit PWM, and with the timer frequency set to 31250 Hz (but with the PWM frequency being a quarter of this), if I wrote a value of 1 (out of 1024, approximately 0.1% duty cycle), the pulse has a duration of 0.000128s, if my calculations are correct, and my low-pass filter does not have a settling time anywhere near that. I don't think it's very likely that a value of 1 would ever need to be written, but I'm considering going back to 8-bit, or trying 9-bit, because of this! =(

edit: duh, I should reduce the frequency, shouldn't I?