CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Problem with HALF BRIDGE PWM and PIC18F4550

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
alcomen



Joined: 13 Dec 2006
Posts: 10

View user's profile Send private message

Problem with HALF BRIDGE PWM and PIC18F4550
PostPosted: Mon May 26, 2008 2:06 pm     Reply with quote

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
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon May 26, 2008 2:42 pm     Reply with quote

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.
Ttelmah
Guest







PostPosted: Mon May 26, 2008 2:47 pm     Reply with quote

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
alcomen



Joined: 13 Dec 2006
Posts: 10

View user's profile Send private message

PostPosted: Mon May 26, 2008 2:58 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group