View previous topic :: View next topic |
Author |
Message |
aliaj00
Joined: 11 May 2011 Posts: 24
|
|
Posted: Fri May 20, 2011 5:15 am |
|
|
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
|
how to fix it |
Posted: Mon Oct 31, 2016 12:22 am |
|
|
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 . |
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
|
|
Posted: Mon Oct 31, 2016 12:43 am |
|
|
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
|
|
Posted: Mon Oct 31, 2016 4:52 pm |
|
|
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
|
|
Posted: Mon Oct 31, 2016 5:18 pm |
|
|
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
Anyway thanks to everyone that tried to read my post.
Regards. |
|
|
|