power control PWM using pic18f4431

Thread Starter

ayu_ayfa

Joined Sep 26, 2011
14
what is the different between the control of CCP PWM and Power Control PWM especially in terms of coding? im looking the way to use the pwm's (no ccp) pins of this micro c..:confused:
 

chrisw1990

Joined Oct 22, 2011
551
sorry this post doesnt quite make sense...
can you provide an example of power control pwm?
the ccp pwm module on the pic allows the user to capture incoming pulses.. or generate pwm.. or compare a value to another value and toggle the output..
so.. whats power control pwm? if you can provide an example ill know what youre on about.
 

atferrari

Joined Jan 6, 2004
4,764
The difference is not in the coding; with the power control module you have more resolution allowing to program lower frequencies than with the PWM "normal" peripheric.

Look at the datasheet. There is an extra prescaler that the other one, has not. It is well explained.
 

Thread Starter

ayu_ayfa

Joined Sep 26, 2011
14
ok,i have notice about the difference of resolutions. i had try to run the coding for power pwm at odd pins by using the ccs manual as a reference.but there is no pwm signal is displayed on oscilloscope.i don't know wether the coding is true or not since there is no error occured..below is the coding..

#define POWER_PWM_PERIOD 1999 // 1 KHz pwm freq with 8 MHz osc.

//=======================================
void main()
{

setup_power_pwm_pins(PWM_ODD_ON, PWM_ODD_ON, PWM_ODD_ON, PWM_ODD_ON);

setup_power_pwm(PWM_FREE_RUN, 1, 0, POWER_PWM_PERIOD, 0, 1,0);

set_power_pwm0_duty((int16)((POWER_PWM_PERIOD *4) * .1)); // 10%
set_power_pwm2_duty((int16)((POWER_PWM_PERIOD *4) * .4)); // 40%
set_power_pwm4_duty((int16)((POWER_PWM_PERIOD *4) * .6)); // 60%
set_power_pwm6_duty((int16)((POWER_PWM_PERIOD *4) * .75)); // 75%

while(1);
}


i simulated the circuit using proteus and i wonder if the circuit for power pwm is just the same as the circuit for ccp which is we just directly connect the oscilloscope to the pins in order to display the pwm signal..:confused::confused:
 

Thread Starter

ayu_ayfa

Joined Sep 26, 2011
14
Chrisw1990..if you look at the pic18f4431 configuration, you will notice that there is another pwm channel in order to produced pwm signal in stead of we used ccp pins..at ccp pins we just can produce max. 2 signals but for this pic, since there are 8 pwm channel we can produce until 8 pwm signals..:)
 
Top