PDA

View Full Version : Setting up 5 HPWM pins on 18F4680



tcbcats
- 2nd August 2006, 05:38
I need to setup 5 hardware PWM outputs on the PIC18F4680.
Has anyone set these up as dedicated outputs that run in the background?
I see the PB setup for HPWM 1, and 2 but not anything more that 2.
Do I have to drop into assembly code to do this or are there defines that I can do that will allow me to just select HPWM 1, 2, 3, 4, and 5.
The frequency of each output can be the same... only the duty cycle needs to vary from 0 to 100% on each pin.

Thanks,
Tcbcats

mister_e
- 2nd August 2006, 05:54
As far as i remind, this one have only 1 CCP module and hence, one PWM output but up to 4 if using the ECCP feature... wich will never solve your problem, all output are complementary (or something like that;) ). So you'll have to build a homebrew routine. A TIMER interrupt for the base frequency and play with the various duty cycles in the ISR.

Kind of background. Look at the Darrel Taylor instant interrupt. Should be handy and work really great.