Enhanced Capture (eCAP) Module
Table 15-96. ECAP Initialization for CAP Mode Absolute Time, Rising Edge Trigger
Register
Bit
Value
ECCTL1
CAP1POL
EC_RISING
ECCTL1
CAP2POL
EC_RISING
ECCTL1
CAP3POL
EC_RISING
ECCTL1
CAP4POL
EC_RISING
ECCTL1
CTRRST1
EC_ABS_MODE
ECCTL1
CTRRST2
EC_ABS_MODE
ECCTL1
CTRRST3
EC_ABS_MODE
ECCTL1
CTRRST4
EC_ABS_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-9. Code Snippet for CAP Mode Absolute Time, Rising Edge Trigger
// Code snippet for CAP mode Absolute Time, Rising edge trigger
// Run Time ( e.g. CEVT4 triggered ISR call)
//==========================================
TSt1 = ECAPxRegs.CAP1;
// Fetch Time-Stamp captured at t1
TSt2 = ECAPxRegs.CAP2;
// Fetch Time-Stamp captured at t2
TSt3 = ECAPxRegs.CAP3;
// Fetch Time-Stamp captured at t3
TSt4 = ECAPxRegs.CAP4;
// Fetch Time-Stamp captured at t4
Period1 = TSt2-TSt1;
// Calculate 1st period
Period2 = TSt3-TSt2;
// Calculate 2nd period
Period3 = TSt4-TSt3;
// Calculate 3rd period
1620
Pulse-Width Modulation Subsystem (PWMSS)
SPRUH73H – October 2011 – Revised April 2013
Copyright © 2011–2013, Texas Instruments Incorporated