Input Capture Mode; Output Compare Mode - Texas Instruments CC253x User Manual

System-on-chip for 2.4ghz
Table of Contents

Advertisement

Input Capture Mode

9.7
Input Capture Mode
When a channel is configured as an input capture channel, the I/O pin associated with that channel is
configured as an input. After the timer has been started, a rising edge, falling edge, or any edge on the
input pin triggers a capture of the 16-bit counter contents into the associated capture register. Thus, the
timer is able to capture the time when an external event takes place.
NOTE: Before an I/O pin can be used by the timer, the required I/O pin must be configured as a
Timer 1 peripheral pin.
The channel input pin is synchronized to the internal system clock. Thus, pulses on the input pin must
have a minimum duration greater than the system clock period.
The content of the 16-bit capture register is read out from registers T1CCnH:T1CCnL.
When the capture takes place, the interrupt flag for the channel, T1STAT.CHnIF (n is the channel
number), is set. An interrupt request is generated if enabled; see
9.8

Output Compare Mode

In output compare mode, the I/O pin associated with a channel is set as an output. After the timer has
been started, the contents of the counter are compared with the contents of the channel compare register
T1CCnH:T1CCnL. If the compare register equals the counter contents, the output pin is set, reset, or
toggled, according to the compare output mode setting of T1CCTLn.CMP. Note that all edges on output
pins are glitch-free when operating in a given output compare mode. Writing to the compare register
T1CCnL is buffered, so that a value written to T1CCnL does not take effect until the corresponding high-
order register, T1CCnH, is written. Writing to compare registers T1CCnH:T1CCnL does not take effect on
the output compare value until the counter value is 0x00.
Note that channel 0 has fewer output compare modes because T1CC0H:T1CC0L has a special function in
modes 6 and 7, meaning these modes would not be useful for channel 0.
When a compare occurs, the interrupt flag for the channel, T1STAT.CHnIF (n is the channel number), is
set. An interrupt request is generated if enabled; see
Examples of output compare modes in various timer modes are given in the following figures.
Edge-aligned: PWM output signals can be generated using the timer modulo mode and channels 1 and 2
in output compare mode 6 or 7 (defined by the T1CCTLn.CMP bits, where n is 1 or 2) as shown in
Figure
9-4. The period of the PWM signal is determined by the setting in T1CC0, and the duty cycle is
determined by T1CCn, where n is the PWM channel, 1 or 2.
The timer free-running mode may also be used. In this case, CLKCONCMD.TICKSPD and the prescaler
divider value in the T1CTL.DIV bits set the period of the PWM signal. The polarity of the PWM signal is
determined by whether output compare mode 6 or 7 is used.
PWM output signals can also be generated using output compare modes 4 and 5 as shown in
or by using modulo mode as shown in
simple PWM.
Center-aligned: PWM outputs can be generated when the timer up-and-down mode is selected. Channel
output compare mode 4 or 5 (defined by T1CCTLn.CMP bits, where n is 1 or 2) is selected, depending on
the required polarity of the PWM signal. The period of the PWM signal is determined by T1CC0, and the
duty cycle for the channel output is determined by T1CCn, where n is the PWM channel, 1 or 2.
The center-aligned PWM mode is required by certain types of motor-drive applications, and typically less
noise is produced than in the edge-aligned PWM mode, because the I/O pin transitions are not lined up on
the same clock edge.
In some types of applications, a defined delay or dead time is required between outputs. Typically, this is
required for outputs driving an H-bridge configuration to avoid uncontrolled cross-conduction in one side of
the H-bridge. The delay or dead-time can be obtained in the PWM outputs by using T1CCn as shown in
the following:
106
Timer 1 (16-Bit Timer)
Section 9.10
Figure
9-5. Using output compare mode 4 or 5 is preferred for
Copyright © 2009–2014, Texas Instruments Incorporated
Section 9.10
for details.
for details.
SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
www.ti.com
Figure
9-4,

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents