PIC18F4550 pwm frequency

Discussion in 'Embedded Systems and Microcontrollers' started by isolete_m, Jun 12, 2016.

  1. isolete_m

    Thread Starter New Member

    Jun 12, 2016
    2
    0
    Hello,

    I read in the datasheet that the equation for the pwm period is PWM period = [(PR2 + 1) * 4 * Tosc * PrescalerTimer2].

    I need a 120Hz frequency (8.3ms period), but it seems I can't reach it. I'm using Fosc=16MHz, and by my calculations, the highest pwm period I can achieve is 1.024ms. Is that correct? Is there any way I can have 120Hz pwm frequency with this Fosc?
     
  2. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,570
    2,380
    isolete_m likes this.
  3. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,398
    497
    isolete_m likes this.
  4. atferrari

    AAC Fanatic!

    Jan 6, 2004
    2,652
    766
    If you have to stick to that micro, then probably the sole way to go is reduce the Xtal frequency.

    If you can select a different one, the 18F4431 for example, allows you to reach PWM lower than 50 Hz. The secret: in one of the peripheral it has an additional prescaler thta brigns everything down to what you need.
     
    isolete_m likes this.
Loading...