View previous topic :: View next topic |
Author |
Message |
alcomen
Joined: 13 Dec 2006 Posts: 10
|
Problem with HALF BRIDGE PWM and PIC18F4550 |
Posted: Mon May 26, 2008 2:06 pm |
|
|
Hi all,
I´m using a PIC18F4550 and half bridge config. As the MOSFET need a time to take off, I need config the dead-band or the MOSFET´s enter into shortcurt.
When the change PDC6~PDC0 in ECCP1DEL the results is not as expected. Instead of increase the time between the edges of descent 1 and the signal rising edge of the signal 2, it increased the time of descent so signal 1, that is worsening the situation.
My code is below:
Code: |
#include <18f4550.h>
#device ADC=10
#fuses HS,NOWDT,NOPROTECT,NOLVP,DEBUG,CPUDIV1,VREGEN
#use delay(clock=20000000)
#bit ECCP1DEL_bit7 = 0xfb7.7
#bit ECCP1DEL_bit6 = 0xfb7.6
#bit ECCP1DEL_bit5 = 0xfb7.5
#bit ECCP1DEL_bit4 = 0xfb7.4
#bit ECCP1DEL_bit3 = 0xfb7.3
#bit ECCP1DEL_bit2 = 0xfb7.2
#bit ECCP1DEL_bit1 = 0xfb7.1
#bit ECCP1DEL_bit0 = 0xfb7.0
void main()
{
DISABLE_INTERRUPTS(GLOBAL);
set_tris_d(0x00);
SETUP_TIMER_2(T2_DIV_BY_16,254,1);
SETUP_CCP1(CCP_PWM_HALF_BRIDGE|CCP_PWM_L_L|CCP_SHUTDOWN_AC_F);
set_pwm1_duty(0);
ECCP1DEL_bit6 = 1;
while(TRUE)
{
unsigned long int time;
for(time=0;time<1000;time++)// test only
{
delay_ms(20);
set_pwm1_duty(500);
}
for(time=1000;time>0;time--)// test only
{
delay_ms(20);
set_pwm1_duty(500);
}
}
} |
Alessandro |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon May 26, 2008 2:42 pm |
|
|
I tested your code. It works OK. There is a dead-band between the
active low PWM signals on pins C2 and D5 of about 12 us. That's
approximately correct.
Look at this figure in the 18F4550 data sheet. It's on page 153 (page 155
in the Acrobat reader):
Quote: | FIGURE 16-3: PWM OUTPUT RELATIONSHIPS (ACTIVE-LOW STATE) |
This shows the timing diagrams for the Active Low waveforms.
Look at the waveforms for:
Code: | Half-Bridge P1A Modulated
P1B Modulated |
It shows two low-level pulses, with a dead-band (at a high level) between
the pulses. That's what I see on my scope when I run your program. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Mon May 26, 2008 2:47 pm |
|
|
Why are you using the tri-state mode?. The delay times are only shown in the data sheet, for active_low, or active_high drives. With the inactive state 'undriven', the deadband behaviour in tri-state mode, will depend on what external pull-up/pull down is present....
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
alcomen
Joined: 13 Dec 2006 Posts: 10
|
|
Posted: Mon May 26, 2008 2:58 pm |
|
|
ok, ok....
the code was:
CCP_PWM_L_L
The correct is:
CCP_PWM_H_H
Now this correct, thank you PCM programmer and Ttelmah.
The diagram in page 153 says it all.
Alessandro |
|
![](templates/subSilver/images/spacer.gif) |
|