Picking PWM frequency

Discussion in 'General Electronics Chat' started by CanElec, Dec 29, 2008.

  1. CanElec

    Thread Starter Member

    Nov 23, 2008

    I am trying to drive a Tamiya FA-130 motor (first one on this page: http://www.superdroidrobots.com/product_info/tamiya_motors.htm), using PWM from an ATMega32 microcontroller.

    I am using these MOSFETs for the switching the PWM: http://www.datasheetcatalog.org/datasheets2/46/462331_1.pdf

    Should I be able to figure out the appropriate PWM frequency based on some combination of the "Turn on delay time", "rise time", "Turn off delay time", "fall time"?

    I was going to use 15KHz, but the only way to get this using an 8MHz clock is by using 6-bit (PWM top set to 63) PWM with a prescaler of 8. Unfortunately this makes it a pain if you want to move 8-bit analog input values into your PWM compare value. I guess I could do two consecutive right bit shifts to scale the 8-bit values into 6 bit, but this seems like something that could be avoided if I plan this properly.