PDA

View Full Version : HPWM with 18F4220



Srigopal007
- 18th November 2004, 17:24
Hello everyone,

I am planning on using a pic with multiple PWM (around 4PWM) . I was looking into the PIC18F4220 which has up to 4 PWM modules. I have just checked to see if pbp supports this controller and it does. I am currently using PBP version 2.45. I have also read the section on HPWM in the compiler and it does not mention anything about how to execute 4 HPWM channels. in the product data sheet it mentions that the pin associated with each of the PWM channels are the following
PWM OUTPUT 1A --> PORTC.3
PWM OUTPUT 1B --> PORTD.5
PWM OUTPUT 1C --> PORTD.6
PWM OUTPUT 1D --> PORTD.7
here is what I am wondering, how do i write code so that I can utilize each of the PWM module. becasue I plan to use all of the four module. Any help with code examples would be greatly appreciated. many thanks in advance

srigopal

mister_e
- 19th November 2004, 01:06
hi srig.

HPWM 1,duty1,1000 ;PWM channel 1

HPWM 2,duty2,1000 ;PWM channel 2

HPWM 3,duty3,1000 ;PWM channel 3

HPWM 4,duty4,1000 ;PWM channel 4

that's it. In many case frequency of PWM must be the same on each channel.


regards

Srigopal007
- 19th November 2004, 16:56
but I contacted the pbp support line and they said that for the first two you can use the HPWM command but for the last two I will need to set up the registers and go through all the process of manually setting the registers and basically they said to do it the long wayyy.. thats is the only way to go about working this 4 channel HPWM feature on the 18F4220. This is waht the pbp support people said.


srigopal.

mister_e
- 19th November 2004, 20:18
mmm good to know that. i<ve never use more than 2 HPWM.