www.ti.com

Counter-Compare (CC) Submodule

2.3.1 Purpose of the Counter-Compare Submodule

The counter-compare submodule takes as input the time-base counter value. This value is continuously compared to the counter-compare A (CMPA) and counter-compare B (CMPB) registers. When the time-base counter is equal to one of the compare registers, the counter-compare unit generates an appropriate event.

The counter-compare:

Generates events based on programmable time stamps using the CMPA and CMPB registers

CTR = CMPA: Time-base counter equals counter-compare A register (TBCTR = CMPA).

CTR = CMPB: Time-base counter equals counter-compare B register (TBCTR = CMPB)

Controls the PWM duty cycle if the action-qualifier submodule is configured appropriately

Shadows new compare values to prevent corruption or glitches during the active PWM cycle

2.3.2Controlling and Monitoring the Counter-Compare Submodule

The counter-compare submodule operation is controlled and monitored by the registers shown in Table 2-4:

Table 2-4. Counter-Compare Submodule Registers

Register Name

Address Offset

Shadowed

Description

CMPCTL

0x0007

No

Counter-Compare Control Register.

CMPAHR

0x0008

Yes

HRPWM Counter-Compare A Extension Register (1)

CMPA

0x0009

Yes

Counter-Compare A Register

CMPB

0x000A

Yes

Counter-Compare B Register

(1)This register is available only on ePWM modules with the high-resolution extension (HRPWM). On ePWM modules that do not include the HRPWM this location is reserved. This register is described in the TMS320x28xx, 28xxx High-Resolution Pulse Width Modulator (HRPWM) Reference Guide (SPRU924). Refer to the device specific data manual to determine which ePWM instances include this feature.

Figure 2-12. Detailed View of the Counter-Compare Submodule

 

Time

TBCTR[15:0]

16

 

Base

 

 

 

(TB)

 

 

 

Module

 

16

 

 

CMPA[15:0]

 

 

 

CTR￿=￿PRD

Shadow

CMPA

 

CTR￿=0

load

Compare￿A￿Active￿Reg.

 

CMPA

 

 

 

 

 

 

Compare￿A￿Shadow￿Reg.

CMPCTL[LOADAMODE]

TBCTR[15:0]

16

 

 

 

 

 

CMPB[15:0]

16

 

 

 

 

 

 

 

Shadow

 

 

 

 

 

 

 

 

 

 

 

 

 

CTR￿=￿PRD

 

 

 

 

CMPB

 

 

 

 

load

 

 

 

 

 

 

 

Compare￿B￿Active￿Reg.

 

CTR￿=￿0

 

 

 

 

 

 

 

 

 

 

 

CMPB

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Compare￿B￿Shadow￿Reg.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CTR￿=￿CMPA

 

 

 

 

 

 

 

Digital

 

comparator￿A

 

 

CMPCTL

 

[SHDWAFULL]

Action

 

 

 

 

 

 

CMPCTL

Qualifier

 

(AQ)

[SHDWAMODE]

Module

 

 

 

 

 

 

 

 

 

 

CTR￿=￿CMPB

Digital comparator￿B

CMPCTL[SHDWBFULL]

CMPCTL[SHDWBMODE]

CMPCTL[LOADBMODE]

SPRU791D–November 2004–Revised October 2007

ePWM Submodules

33

Submit Documentation Feedback

Page 33
Image 33
Texas Instruments 28xxx Purpose of the Counter-Compare Submodule, Controlling and Monitoring the Counter-Compare Submodule