dgs117
Member level 1
Hello,
I am building an inverter for 220V. I have constructed the output stage with IGBT transistors (IRG4PH50KDPbF), drivers for each transistor (HCPL-3120) each having their own separate power supply. At the output is LC filter which filters the undesired harmonics.
The problem is generating a sinusoidal PWM signal from PIC18F4520 which lies in EasyPIC4 development board. I decided to go with the instructions in PIC18F4520 datasheet for generating bidirectional Full-bridge output PWM signal (https://ww1.microchip.com/downloads/en/DeviceDoc/39631E.pdf, pages 153-155). I have a problem during the direction change of PWM signal. As shown in Figure 16-8 in datasheet there is a time interval between the direction really changes. I can observe this phenomenon in the oscilloscope as the signal swithes at zero between the half periods of the sinusoidal signal.
So I ask you how could I avoid this zero switching distortion? Is there a solution?
The PWM carrier frequency is 7.8 kHz, and the look-up table of sinusoidal signal consists of 32 entries. The CCPR1L register is updated during during interrupt which occurs at a freq for 50 Hz output.
The schematic and waveforms are attached below. The osc used is Tektronix TPS2024 with current clamp A622. The problem is indicated in red circles in the waveforms.
The ISR of the PIC firmware is as follows:
I am building an inverter for 220V. I have constructed the output stage with IGBT transistors (IRG4PH50KDPbF), drivers for each transistor (HCPL-3120) each having their own separate power supply. At the output is LC filter which filters the undesired harmonics.
The problem is generating a sinusoidal PWM signal from PIC18F4520 which lies in EasyPIC4 development board. I decided to go with the instructions in PIC18F4520 datasheet for generating bidirectional Full-bridge output PWM signal (https://ww1.microchip.com/downloads/en/DeviceDoc/39631E.pdf, pages 153-155). I have a problem during the direction change of PWM signal. As shown in Figure 16-8 in datasheet there is a time interval between the direction really changes. I can observe this phenomenon in the oscilloscope as the signal swithes at zero between the half periods of the sinusoidal signal.
So I ask you how could I avoid this zero switching distortion? Is there a solution?
The PWM carrier frequency is 7.8 kHz, and the look-up table of sinusoidal signal consists of 32 entries. The CCPR1L register is updated during during interrupt which occurs at a freq for 50 Hz output.
The schematic and waveforms are attached below. The osc used is Tektronix TPS2024 with current clamp A622. The problem is indicated in red circles in the waveforms.
The ISR of the PIC firmware is as follows:
Code:
// Half period 32 points sinewave lookup table
const unsigned short int sinewave[32]=
{
0,25,49,73,96,118,137,159,177,193,208,220,231,239,
245,249,250,249,245,239,231,220,208,193,177,159,137,
118,96,73,49,25
};
unsigned short int i=0;
void interrupt()
{
if(TMR0IF_bit) // TIMER0 interrupt
{
TMR0IF_bit = 0; // clear TMR0 overflow interrupt flag bit
if(i==32)
{
i=0;
P1M1_bit = ~P1M1_bit; // Full-bridge change output direction
}
CCPR1L = sinewave[i]; // put a new value for PWM duty cycle
TMR0L = 109; // interrupt for 50Hz output
i++; // increment table counter
}
}