AnsweredAssumed Answered

3 Phase Pwm Inverter

Question asked by Rui Mausinho on Sep 18, 2015
Latest reply on Sep 28, 2015 by Ankur Kala

Hello,

As the title indicates i'm trying to implement a program to control a gate driver using PWM signals. This ones should have follow characteristics for work correctly:   180 degrees shifted, sine wave working specific at 50HZ , and PWM frequency upper than 12kHZ.

 

All of the tasks i already fixed, except the problem that i can't guarantee the sine wave with 50HZ, and i don´t have any idea how to do, after trying a lot of manipulations with the pwm registers.

 

There is any way to do with controlling the timers, like respecting the time for "load" the 256 values to a pwm register? Following the thinking of F=50HZ, so T= 20 ms ? But in this case, the timer that i'm using (and the only one that i'm allowed in PWM MOTOR CONTROL BEAN) it´s PWM_TIMER , and that one i can´t choice the pulse width neither know how that is preset.

 

Anyone can help me or give me some suggest in this problem?

I'm getting really unmotivated at this moment, too much time stranded in this point. Any help or suggest is welcome.

 

Part of the code:

 

const unsigned short int PHASE[256] = {

128,131,134,137,140,143,146,149,

152,155,158,162,165,167,170,173,

176,179,182,185,188,190,193,196,

198,201,203,206,208,211,213,215,

218,220,222,224,226,228,230,232,

234,235,237,238,240,241,243,244,

245,246,248,249,250,250,251,252,

253,253,254,254,254,255,255,255,

255,255,255,255,254,254,254,253,

253,252,251,250,250,249,248,246,

245,244,243,241,240,238,237,235,

234,232,230,228,226,224,222,220,

218,215,213,211,208,206,203,201,

198,196,193,190,188,185,182,179,

176,173,170,167,165,162,158,155,

152,149,146,143,140,137,134,131,

128,124,121,118,115,112,109,106,

103,100,97,93,90,88,85,82,

79,76,73,70,67,65,62,59,

57,54,52,49,47,44,42,40,

37,35,33,31,29,27,25,23,

21,20,18,17,15,14,12,11,

10,9,7,6,5,5,4,3,

2,2,1,1,1,0,0,0,

0,0,0,0,1,1,1,2,

2,3,4,5,5,6,7,9,

10,11,12,14,15,17,18,20,

21,23,25,27,29,31,33,35,

37,40,42,44,47,49,52,54,

57,59,62,65,67,70,73,76,

79,82,85,88,90,93,97,100,

103,106,109,112,115,118,121,124

};

 

                       /*  hardware topology */

    PWM_VAL0 = 0x0000; /* Minimum duty cycle for pair PWM1:2 */

    PWM_VAL2 = 0x0000; /* Minimum duty cycle for pair PWM3:4 */

    PWM_VAL4 = 0x0000; /* Minimum duty cycle for pair PWM5:6 */

 

PWMC1_Load();    /* Load new PWM values */
PWMC1_EnableEvent();      // enable eventsPWMC1_Enable();           // enable PWMMC

 

 

 

 

//PWMC1_OutputPadEnable();

 

// Set modulus (PWM period)

    PWM_CMOD = PWM_MODULO;

   

    // Set counter values (PWM duty cycle)

//pwm_change_duty(v0,v1,v2);
PWM_VAL0 = PHASE[TableIndex];

    //PWM_VAL1 = PHASE_A[TableIndex];

    PWM_VAL2 = PHASE[(TableIndex+85)];

    //PWM_VAL3 = PHASE_B[TableIndex];

    PWM_VAL4 = PHASE[(TableIndex+170)];

    //PWM_VAL5 = PHASE_C[TableIndex];

    PWM_CTRL |= PWM_CTRL_LDOK;

PWMC1_Load();    /* Load new PWM values */

    TableIndex++;           /* Update Table Index*/

   

    if (TableIndex == 256)

    {

        TableIndex = 0;     /* Reset Table Index */

    }

       

   PWMC1_EnableEvent();      // enable eventsPWMC1_Enable();           // enable PWMMC

 

PWMC1_OutputPadEnable();

Outcomes