Fast PWM

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am working on a project that I need to do a high frequency PWM (50KHz) with a variable duty cycle. As we change the duty cycle, we get varied results of resolution. We are running a Mega8 at 8MHz. I though there was an option to set a high-speed PWM mode that would I/O clock at 24MHz, but I can't find it in the datasheet.

Is there a better way to set the duty cycle on Timer2, than the FastPWM and change the TCNTn value for the frequency and OCRn for the duty?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't think the mega8 has a 24MHz PLL. The tiny15 does have a 25.6MHz fast pwm though. That should get you up to 100kHz. (or higher if you mess with the OSCCAL)

Igor

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You don't need to use the internal PWM, you can write your own PWM routine also. Are much faster up to MHz' !
(very fast PWM)

admin's test signature