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

pic16F887 Half Bridge problem
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
aliaj00



Joined: 11 May 2011
Posts: 24

View user's profile Send private message

PostPosted: Fri May 20, 2011 5:15 am     Reply with quote

In my code it is working but when I connect the 2n3417 to the IRFP31N50L both IRFP-s start I noticed a spike from one output to the other one that is triggering the transistors. Have anyone the idea how to fix this.


Thanks a lot to all.

BR's

Shpetim Aliaj
vandongvo



Joined: 31 Oct 2016
Posts: 1

View user's profile Send private message

how to fix it
PostPosted: Mon Oct 31, 2016 12:22 am     Reply with quote

aliaj00 wrote:
hi i just tested it and the output is only on RC2 and nowhere else. i must be missing something as the code compiled.

PLEASE HELP Smile.

you need only change this code line:
Code:
 setup_ccp1(CCP_PWM_HALF_BRIDGE|CCP_PWM_H_H);
Ttelmah



Joined: 11 Mar 2010
Posts: 19499

View user's profile Send private message

PostPosted: Mon Oct 31, 2016 12:43 am     Reply with quote

aliaj00 wrote:
In my code it is working but when I connect the 2n3417 to the IRFP31N50L both IRFP-s start I noticed a spike from one output to the other one that is triggering the transistors. Have anyone the idea how to fix this.


Thanks a lot to all.

BR's

Shpetim Aliaj


Without seeing your circuit, it is impossible to know.
However, general comments. Though 'MOSFETs' are voltage controlled, and need only a tiny current to keep them on/off, once they are switched, they have very high gate capacitance's. It needs significant current to charge/discharge these quickly. In the case of your FET 5000pF. This is why proper FET drivers can usually momentarily deliver currents like 1.5A. It sounds like you are possibly trying to use a transistor/resistor to control the gate. If so, the transistor will switch one way quite quickly, but the opposite direction (pulled by the resistor), will be very slow. Perfectly alright for a slow on/off, but not for a PWM. May well give problems when you start wanting to switch quickly. Look at how proper FET drives are done.
Then second comment. Make sure that the drives will be biased 'off' (resistors on the bases of the transistors), when the PIC is not driving/enabled. Remember that the outputs from the PIC will be floating when the chip first wakes. It is always vital to design the drive to 'fail off' when undriven.
mikimtb



Joined: 18 Mar 2012
Posts: 4
Location: Serbia

View user's profile Send private message

PostPosted: Mon Oct 31, 2016 4:52 pm     Reply with quote

Hi to everybody. I'm also trying to control PIC16F887 in PWM half bridge mode, but without success. The PWM mode has been successfully set, but I can't set polarity. Using any of listed settings:
Code:

#define CCP_PWM_H_H                     0x0c
#define CCP_PWM_H_L                     0x0d
#define CCP_PWM_L_H                     0x0e
#define CCP_PWM_L_L                     0x0f

I'm not able to set PWM in complementary mode. All the time signals on P1A and P1B are in phase.

I need to set PWM outputs in complementary mode. I'm using v5.045 version of compiler.

Microcontroller is run on 8MHz internal oscillator. My code to set PWM is:
Code:
/**
 * Function initialize PWM interface to produce 40KHz PWM
 * The module is set to operate in HALF_BRIDGE_MODE
 * The PWM pins pair are set to be complementary on to another
 */
void pwm_init()
{
    #byte PIR1 = 0x0c;
    #bit TMR2IF = PIR1.1;
   
    setup_ccp1(CCP_PWM_HALF_BRIDGE | CCP_PWM_H_L);
   
    setup_timer_2(T2_DIV_BY_1,49,1);                                    //25.0 us overflow, 25.0 us interrupt
    set_pwm1_duty(24);                                           // Set PWM Duty cycle to 50%
    pwm_set_deadband(3);
   
   
   
    TMR2IF = 0;
    while (!TMR2IF);
    output_drive(P1A);
    output_drive(P1B);
}


I found in errata that dead band should be below PWM duty cycle for proper operation. That is took into account.

Did I miss something? Does somebody else have the same problem?

Regards.
mikimtb



Joined: 18 Mar 2012
Posts: 4
Location: Serbia

View user's profile Send private message

PostPosted: Mon Oct 31, 2016 5:18 pm     Reply with quote

Hi, here I'm again.

Finally I found the source of my problem. Actually everything was ok, the outputs are complementary for CCP_PWM_H_H settings. I borrow hand held oscilloscope from friend of mine and accidentally set trigger on both channels so the signals was aligned even if they are not in phase. Lucky me Smile

Anyway thanks to everyone that tried to read my post.

Regards.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
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