>One thing I have noticed is that the PWM frequency will be about 20 >Hz, with a 4 MHz oscillator. You count 100 timer0 timeouts for each >pulse cycle. There is a table of values that returns the length of the >high part of the cycle but instead of using 100 separate pulse high >times there are actually only about 30 returned by the table >lookup. This means that you could use 32 separate duty cycles and >count only 32 timer0 timeouts instead of 100 and it would give exactly >the same duty-cycle resolution but increase the PWM frequency by a >factor of 3. > >Even still, I was under the impression that it would be desirable to >have a PWM frequency in the kiloHertz range and that only 16 or >perhaps 8 distinct duty cycles would be needed (at least for RC >cars). Can anyone comment on this? Does anyone know what the time >constant of an RC motor is? Malcolm's comments ought to be noted. The PWM should be 2KHz - 3KHz for these motors. I have 100+ distinct speeds in my ESC (forward-only), and that's only using partial range on the input to generate full-range on the output. It is wise to have this many, otherwise one can hear the car "shift" and this is a problem when you are close to the boundary between two speeds. Andy ====================================================================== Andy Kunz - Montana Design - 409 S 6th St - Phillipsburg, NJ 08865 USA Electronics for Industry & R/C Hobbyists "Go fast, turn right, and keep the wet side down!" ======================================================================