power control PWM using pic18f4431

Discussion in 'Embedded Systems and Microcontrollers' started by ayu_ayfa, Apr 16, 2012.

  1. ayu_ayfa

    Thread Starter New Member

    Sep 26, 2011
    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:
  2. chrisw1990

    Active Member

    Oct 22, 2011
    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.
  3. atferrari

    AAC Fanatic!

    Jan 6, 2004
    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.
  4. ayu_ayfa

    Thread Starter New Member

    Sep 26, 2011
    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%


    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:
  5. ayu_ayfa

    Thread Starter New Member

    Sep 26, 2011
    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..:)