Texas Instruments 28xxx, TMS320x28xx manual EPWMxB-Active High, Example 2-2. Code Sample for Figure

Models: 28xxx TMS320x28xx

1 119
Download 119 pages 2.85 Kb
Page 43
Image 43
EPWMxB—Active High

www.ti.com

Action-Qualifier (AQ) Submodule

Figure 2-21. Up, Single Edge Asymmetric Waveform, With Independent Modulation on EPWMxA and

EPWMxB—Active High

TBCTR

TBPRD value

Z

EPWMxA

P

CB

CA

Z

P

CB

CA

Z

P

Z

EPWMxB

P

CB

CA

Z

P

CB

CA

Z

P

APWM period = (TBPRD + 1 ) × TTBCLK

BDuty modulation for EPWMxA is set by CMPA, and is active high (that is, high time duty proportional to CMPA).

CDuty modulation for EPWMxB is set by CMPB and is active high (that is, high time duty proportional to CMPB).

DThe "Do Nothing" actions ( X ) are shown for completeness, but will not be shown on subsequent diagrams.

EActions at zero and period, although appearing to occur concurrently, are actually separated by one TBCLK period. TBCTR wraps from period to 0000.

Example 2-2contains a code sample showing initialization and run time for the waveforms in Figure 2-21.

Example 2-2. Code Sample for Figure 2-21

//Initialization Time

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

EPwm1Regs.TBPRD = 600;

//

Period = 601 TBCLK counts

EPwm1Regs.CMPA.half.CMPA = 350;

//

Compare A = 350 TBCLK counts

EPwm1Regs.CMPB = 200;

//

Compare B = 200 TBCLK counts

EPwm1Regs.TBPHS = 0;

//

Set Phase register to zero

EPwm1Regs.TBCTR = 0;

//

clear TB counter

EPwm1Regs.TBCTL.bit.CTRMODE = TB_UP;

 

 

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 = SYSCLK

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.ZRO = AQ_SET;

 

 

EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR;

 

 

EPwm1Regs.AQCTLB.bit.ZRO = AQ_SET;

 

 

EPwm1Regs.AQCTLB.bit.CBU = AQ_CLEAR;

 

 

//

 

 

//Run Time

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

EPwm1Regs.CMPA.half.CMPA

= Duty1A;

//

adjust

duty

for

output

EPWM1A

EPwm1Regs.CMPB = Duty1B;

 

//

adjust

duty

for

output

EPWM1B

SPRU791D–November 2004–Revised October 2007

ePWM Submodules

43

Submit Documentation Feedback

Page 43
Image 43
Texas Instruments 28xxx manual EPWMxB-Active High, Example 2-2. Code Sample for Figure, Action-Qualifier AQ Submodule