I want to drive the Full bridge configuration for the dc to dc converter. I want to use the two output PWMs from the microcontroller according to this
I also want to vary the duty cycle according to the change in the input voltage.
I'm using PIC18F4550. Also, I want to control Full bridge with two output PWMs from two pins, each driving one leg respectively. This is given in its datasheet at page#156.
ECCP module does say that I can drive it as I want to, But ECCP module is giving output in complemented form like this
I Have selected the driver ICs IR2110, they drive the pairs of low and high side. And the MOSFETs are N-type IRFP150N.
In a nutshell, I need 2 pwm signals, which are 180 degree out of phase with each other, and each one will drive a diagonal pair of fets with the same duty cycle......but indeed I need to have that dead time bit between the two pwms..This limits the duty cycle of each pwm to say 40% maximum.
The code that I've written is in xC8 compiler, is self explanatory and is given below:
Code:
#include<xc.h>
#define _XTAL_FREQ 4000000
void Initmain(){
PR2=0x04; // Frequency: 50KHz
CCP1CON=0b10001100; // Half Bridge Forward; P1A, P1B active-high;
CCPR1L = 0b00000001; // Start with 20% Duty Cycle
ECCP1DEL=1;
TMR2=0;
TMR2IF=0;
T2CON=0b00000101; // Postscale: 1:1, Timer2=On, Prescale = 1:4
while(TMR2IF==0);
TRISC=0;
PORTC=0;
TRISD=0;
PORTD=0;
//ECCP1AS=0b00000000;
ECCPASE=0;
P1M1=1; //MUST WRITE THIS
}
void main(){
Initmain();
while(1)
{
}
}
The output waveforms have different duty cycles, but I need the same on both of them.
I also tried making the dead band time to be variable with the equation (Td=0.5-Duty cycle), which should logically WORK but still the waveform gets rubbish.
Any help PLEASE as I'm really stuck in all this? :/