Enhanced Capture (eCAP) Module
Table 15-99. ECAP Initialization for CAP Mode Delta Time, Rising and Falling Edge Triggers
Register
Bit
Value
ECCTL1
CAP1POL
EC_RISING
ECCTL1
CAP2POL
EC_FALLING
ECCTL1
CAP3POL
EC_RISING
ECCTL1
CAP4POL
EC_FALLING
ECCTL1
CTRRST1
EC_DELTA_MODE
ECCTL1
CTRRST2
EC_DELTA_MODE
ECCTL1
CTRRST3
EC_DELTA_MODE
ECCTL1
CTRRST4
EC_DELTA_MODE
ECCTL1
CAPLDEN
EC_ENABLE
ECCTL1
PRESCALE
EC_DIV1
ECCTL2
CAP_APWM
EC_CAP_MODE
ECCTL2
CONT_ONESHT
EC_CONTINUOUS
ECCTL2
SYNCO_SEL
EC_SYNCO_DIS
ECCTL2
SYNCI_EN
EC_DISABLE
ECCTL2
TSCTRSTOP
EC_RUN
Example 15-12. Code Snippet for CAP Mode Delta Time, Rising and Falling Edge Triggers
// Code snippet for CAP mode Delta Time, Rising and Falling edge triggers
// Run Time ( e.g. CEVT1 triggered ISR call)
//==========================================
// Note: here Time-stamp directly represents the Duty cycle values.
DutyOnTime1 =
ECAPxRegs.CAP2;
// Fetch Time-Stamp captured at T2
DutyOffTime1 = ECAPxRegs.CAP3;
// Fetch Time-Stamp captured at T3
DutyOnTime2 =
ECAPxRegs.CAP4;
// Fetch Time-Stamp captured at T4
DutyOffTime2 = ECAPxRegs.CAP1;
// Fetch Time-Stamp captured at T1
Period1 = DutyO DutyOffTime1;
Period2 = DutyO DutyOffTime2;
1626
Pulse-Width Modulation Subsystem (PWMSS)
SPRUH73H – October 2011 – Revised April 2013
Copyright © 2011–2013, Texas Instruments Incorporated