Dual PWM Output with PIC

Thread Starter

jwilk13

Joined Jun 15, 2011
228
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?
 

ErnieM

Joined Apr 24, 2011
8,377
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.
 

Thread Starter

jwilk13

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

PIC16F1827

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

Markd77

Joined Sep 7, 2009
2,806
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.
 

Thread Starter

jwilk13

Joined Jun 15, 2011
228
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.
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!
 

upand_at_them

Joined May 15, 2010
940
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.
 
Top