Texas Instruments 28xxx, TMS320x28xx manual EPWMxA-Active Low, Example 2-7. Code Sample for Figure

Models: 28xxx TMS320x28xx

1 119
Download 119 pages 2.85 Kb
Page 49
Image 49
EPWMxA—Active Low

www.ti.com

Action-Qualifier (AQ) Submodule

Figure 2-26. Up-Down-Count, Dual Edge Asymmetric Waveform, With Independent Modulation on

EPWMxA—Active Low

TBCTR

CA

EPWMxA

CB

CA

CB

Z

EPWMxB

P

Z

P

APWM period = 2 × TBPRD × TBCLK

BRising edge and falling edge can be asymmetrically positioned within a PWM cycle. This allows for pulse placement techniques.

CDuty modulation for EPWMxA is set by CMPA and CMPB.

DLow time duty for EPWMxA is proportional to (CMPA + CMPB).

ETo change this example to active high, CMPA and CMPB actions need to be inverted (i.e., Set ! Clear and Clear Set).

FDuty modulation for EPWMxB is fixed at 50% (utilizes spare action resources for EPWMxB)

Example 2-7contains a code sample showing initialization and run time for the waveforms in Figure 2-26. Use the code in Example 2-1to define the headers.

Example 2-7. Code Sample for Figure 2-26

//Initialization Time

//= = = = = = = = = = = = = = = = = = = = = = = =

EPwm1Regs.TBPRD = 600;

//

Period = 2 × 600 TBCLK counts

EPwm1Regs.CMPA.half.CMPA = 250;

//

Compare A = 250 TBCLK counts

EPwm1Regs.CMPB = 450;

//

Compare B = 450 TBCLK counts

EPwm1Regs.TBPHS = 0;

//

Set Phase register to zero

EPwm1Regs.TBCNT = 0;

//

clear TB counter

EPwm1Regs.TBCTL.bit.CTRMODE = TB_UPDOWN;

//

Symmetric

EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE;

//

Phase loading disabled

EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW;

 

 

EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_DISABLE;

 

EPwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1;

//

TBCLK = SYSCLKOUT

EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV1;

 

 

EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;

 

 

EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;

 

 

EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; //

load on CTR = Zero

EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; //

load on CTR = Zero

EPwm1Regs.AQCTLA.bit.CAU = AQ_SET;

 

 

EPwm1Regs.AQCTLA.bit.CBD = AQ_CLEAR;

 

 

EPwm1Regs.AQCTLB.bit.ZRO = AQ_CLEAR;

 

 

EPwm1Regs.AQCTLB.bit.PRD = AQ_SET;

 

 

//Run Time

//= = = = = = = = = = = = = = = = = = = = = = = =

EPwm1Regs.CMPA.half.CMPA =

EdgePosA;

// adjust duty for output EPWM1A only

EPwm1Regs.CMPB = EdgePosB;

 

 

SPRU791D–November 2004–Revised October 2007

ePWM Submodules

49

Submit Documentation Feedback

Page 49
Image 49
Texas Instruments 28xxx, TMS320x28xx EPWMxA-Active Low, Example 2-7. Code Sample for Figure, Action-Qualifier AQ Submodule