eCAP
TMS320F2837xD Microcontroller Workshop - Control Peripherals 7 - 41
eCAP
Capture Module (eCAP)
The eCAP module timestamps transitions on a
capture input pin
Can be used to measure the time width of a pulse
Auxiliary PWM generation
Timer
Timestamp
Values
Trigger
pin
t
1
t
2
The capture units allow time-based logging of external signal transitions. It is used to accurately
time external events by timestamping transitions on the capture input pin. It can be used to
measure the speed of a rotating machine, determine the elapsed time between pulses, calculate
the period and duty cycle of a pulse train signal, and decode current/voltage measurements
derived from duty cycle encoded current/voltage sensors.
Capture units can be configured to trigger an A/D conversion that is synchronized with an
external event. There are several potential advantages to using the capture for this function over
the ADCSOC pin associated with the ADC module. First, the ADCSOC pin is level triggered, and
therefore only low to high external signal transitions can start a conversion. The capture unit
does not suffer from this limitation since it is edge triggered and can be configured to start a
conversion on either rising edges or falling edges. Second, if the ADCSOC pin is held high
longer than one conversion period, a second conversion will be immediately initiated upon
completion of the first. This unwanted second conversion could still be in progress when a
desired conversion is needed. In addition, if the end-of-conversion ADC interrupt is enabled, this
second conversion will trigger an unwanted interrupt upon its completion. These two problems
are not a concern with the capture unit. Finally, the capture unit can send an interrupt request to
the CPU while it simultaneously initiates the A/D conversion. This can yield a time savings when
computations are driven by an external event since the interrupt allows preliminary calculations to
begin at the start-of-conversion, rather than at the end-of-conversion using the ADC end-of-
conversion interrupt. The ADCSOC pin does not offer a start-of-conversion interrupt. Rather,
polling of the ADCSOC bit in the control register would need to be performed to trap the
externally initiated start of conversion.