Dual PWM Output with PIC

Discussion in 'Embedded Systems and Microcontrollers' started by jwilk13, Jul 11, 2012.

  1. jwilk13

    Thread Starter Member

    Jun 15, 2011
    Hey again,

    I'm starting up a little project where I want to be able to independently control the output duty cycle of two different PWM waveforms using one PIC. The frequency can stay the same (and since most PICs use TMR2 for PWM operation, I'm guessing they would have to stay the same).

    I have a PIC18F1220 at my disposal, but I'm not sure this particular MCU is capable of having two independent PWM waveforms being output at the same time (lack of a CCP2 output). Can anyone confirm this?
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    Capture/Compare/PWM Peripherals: 1 ECCP

    As one is less than two you would be forced to make at least one PWM output via software.

    However, there are several PIC18 devices that have two or three modules.
    jwilk13 likes this.
  3. jwilk13

    Thread Starter Member

    Jun 15, 2011
    I found a PIC16 that should work, and it's half the cost.


    You confirmed my initial thoughts though. It's something I've never tried, so I figured I would at least ask.
  4. Markd77

    Senior Member

    Sep 7, 2009
    PIC10F320 / 322 can do it if you can survive with only two other pins.
    It's a nifty little chip I will be trying soon.
    It's about 1/3 the price of the 1827 according to Microchips pricing.
  5. jwilk13

    Thread Starter Member

    Jun 15, 2011
    I wish I could get away with it! I have 2 more analog inputs, 2 digital outputs, and a digital input along with the 2 PWM outputs I have to consider as well.

    Not a bad situation, but still too much for the 10F320. It's a neat little chip though...and to think I'm only 3 I/O pins away from being able to use it!
  6. upand_at_them

    Senior Member

    May 15, 2010
    You can do this on any PIC with two timers. You don't need the PWM module at all. You set one timer to handle the PWM period (frequency). The other timer is used to set the duty cycle for one PWM, then the other PWM, then nothing until the PWM period resets.