PDA

View Full Version : Timer based PWM with HPWM



jmgelba
- 22nd November 2011, 13:30
Having a little trouble setting up 2 PWM signals. I'm using the 18F2550 with 20MHz ceramic res, setup for USB. DEFINE OSC is 48MHz.

Based on the pwm used in this design: http://www.picbasic.co.uk/forum/showthread.php?t=15602 I can get the 260Khz pwm to work fine but when I use CCP2 for the HPWM 2 output, HPWM 2 has a frequency that matches the timer based pwm on CCP1.

If I setup a HPWM on CCP1 of any frequency, and another on CCP2 also of any frequency, they both change to 6.6KHz. However if I disable either one, then the remaining one functions at the desired frequency.

Any ideas on what I am missing?

prstein
- 23rd November 2011, 04:16
Take a look at table 15-2 in the datasheet. If I understand it correctly both hardware PWMs must share the same frequency.

Best Regards,
Paul