A problem with PIC18F4431

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

  1. ayu_ayfa

    Thread Starter New Member

    Sep 26, 2011
    14
    0
    hi,

    i am using pic18f4431 to drive 3-phase inverter. Before this i try to generate just an ordinary pwm signals by using this code below and it works very well :

    void main()
    {

    setup_power_pwm_pins(PWM_BOTH_ON, PWM_BOTH_ON, PWM_BOTH_ON, PWM_BOTH_ON);


    setup_power_pwm(PWM_CLOCK_DIV_4|PWM_FREE_RUN, 1, 0, 4000, 0, 1,0);

    set_power_pwm0_duty(4000);
    set_power_pwm2_duty(4000);
    set_power_pwm4_duty(4000);
    set_power_pwm6_duty(4000);

    while(1);
    }

    however, from datasheet, it said that we need to use pwm override in order to get the sequence between the pulse..hence i modified my coding as follows but it doesn't work.the signal displayed is still the same as earlier..


    void main()
    {
    setup_power_pwm_pins(PWM_BOTH_ON, PWM_BOTH_ON, PWM_BOTH_ON, PWM_BOTH_ON);

    set_power_pwm_override(0,false,1);
    set_power_pwm_override(1,false,1);
    set_power_pwm_override(2,false,1);
    set_power_pwm_override(3,false,1);
    set_power_pwm_override(4,false,1);
    set_power_pwm_override(5,false,1);

    setup_power_pwm(PWM_CLOCK_DIV_4|PWM_FREE_RUN, 1, 0, 4000, 0, 1,0);

    set_power_pwm0_duty(4000);
    set_power_pwm2_duty(4000);
    set_power_pwm4_duty(4000);
    set_power_pwm6_duty(4000);

    while(1);
    }


    anyone who is expert,i am very grateful for your helping..:)
     
Loading...