PDA

View Full Version : Two independant HPWM possible?



jamie_s
- 8th June 2007, 18:23
Is there a way to have 2x HWPWM outputs from one PIC, that will run at the same frequency but at a different duty cycle?

skimask
- 8th June 2007, 18:42
Is there a way to have 2x HWPWM outputs from one PIC, that will run at the same frequency but at a different duty cycle?

Totally depends on the PIC. Go to Microchip's website and look.

Darrel Taylor
- 8th June 2007, 21:09
Or, if you need fairly low frequencies (10-200hz) and your PIC doesn't have 2 CCP's, this might work...

(SPWM_INT - Multiple Software PWM)
http://darreltaylor.com/DT_INTS-14/SPWM.html
<br>

jamie_s
- 9th June 2007, 03:05
Totally depends on the PIC. Go to Microchip's website and look. Yeah, ive looked at some datasheets and the ones i've looked at show both pwm's using the same timer.

Has anyone got any idea on what pics may have dual hardware pwm that would suit ?
It needs to be hardware instead of software, and will be used to run two solenoids

skimask
- 9th June 2007, 04:11
Yeah, ive looked at some datasheets and the ones i've looked at show both pwm's using the same timer.

Has anyone got any idea on what pics may have dual hardware pwm that would suit ?
It needs to be hardware instead of software, and will be used to run two solenoids

Well, if it's going to run two solenoids, chances are they aren't going to run any more than 100Hz or so (unless you've got special solenoids that run at a lot more than that :) ).
The Multiple Software PWM practically runs in the background and works well.
Myself, I have been able to do software PWM running 63 LEDs, all with independent PWM on a 18F8722, with instruction cycles leftover to do other things.
Past that, if you really need that much processing power (and I'm guessing you really don't, but think you do), you're probably better off with 3 separate PIC's, one master, and a couple of slave PICs, each one doing it's own PWM.

sougata
- 9th June 2007, 08:33
Hi,

While the timebase is fixed to a single timer the frequency of the PWMs remain same. But for PICs with 2 PWMs you need to update the registers CCPR1L and CCPR2L with your desired duty cycle. Example 16F877A, 18F452.

jamie_s
- 11th June 2007, 08:42
Hi,

While the timebase is fixed to a single timer the frequency of the PWMs remain same. But for PICs with 2 PWMs you need to update the registers CCPR1L and CCPR2L with your desired duty cycle. Example 16F877A, 18F452.

Thanks - thats what i was looking for - the 16F877A