chibi41
Joined: 16 Apr 2012 Posts: 12
|
A problem with PIC18F4431 |
Posted: Fri Apr 20, 2012 9:14 am |
|
|
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 :
Code: |
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.
Code: |
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.. |
|