ADP315PC87570 National Semiconductor, ADP315PC87570 Datasheet - Page 112

no-image

ADP315PC87570

Manufacturer Part Number
ADP315PC87570
Description
Keyboard and Power Management Controller
Manufacturer
National Semiconductor
Datasheet
Mode 4, Input Capture and Timer
It is also possible to operate in a mode which offers a com-
bination of a single timer with automatic reload and a single
capture timer. In this mode TCNT1 operates as a PWM-tim-
er which is reloaded from TCRA on underflow while TCNT2
forms the time base of the capture timer. The value on
TCNT2 is transferred to TCRB on detection of a valid event
on TB. It is possible to toggle TA on every underflow of
TCNT1 and thus generate a 50% duty cycle PWM signal on
TA.
This mode is a combination of mode 3 and mode 2, and al-
lows you to operate the timer/counter 2 as a single input
capture timer, while timer/counter 1 can be used as a sys-
tem timer as described above. Figure 14-7 shows a block
diagram of the timer in mode 4.
TCNT1 starts counting down once a clock has been en-
abled. On underflow TCNT1 is reloaded from the TCRA reg-
ister, and counting proceeds downwards from that value. If
enabled the TA pin toggles on every underflow of TCNT1.
Software can select the initial value of the TA output signal
as either high or low. See “Timer I/O Functions” on page
113 for additional details. In addition, the TAPND interrupt
pending flag is set, and a timer interrupt 1 is generated, if
the TAIEN bit is set to 1. (See Section “Timer Interrupts” on
page 113 for detailed information). Since TA toggles on ev-
ery underflow a 50% duty cycle PWM signal can be gener-
ated on TA without requiring any interaction of the user
software and thus the CPU.
Timer 1
Clock
Timer 2
Clock
Timer/Counter 1
Timer/Counter 2
Capture B
TCNT1
Reload A
Figure 14-7. Mode 4, Input Capture and Timer
TCRA
TCRB
TCNT2
Multi-Function 16-Bit Timer (MFT16)
Underflow
Preset
112
TCNT2 starts counting down once a clock has been en-
abled. When a transition is received on TB the value con-
tained in TCNT2 is transferred to TCRB, and the interrupt
pending flag TBPND is set. A timer interrupt 2 is generated,
if it is enabled. You can enable a preset of the counter to
FFFFh on detection of a transition on TB. In this case the
current value of TCNT2 is transferred to TCRB, followed by
a preset of the counter to FFFFh. TCNT2 starts counting
downwards from FFFFh, until the next transition is received
on TB, which causes the procedure of capture and preset to
be repeated. Underflow of TCNT2 sets the TDPND interrupt
pending flag, and can also generate a timer interrupt II, if
enabled. (See Section “Timer Interrupts” for detailed infor-
mation.) The input signal on TB must have a pulse width
equal to, or greater than, one system clock cycle. (See the
AC Electrical Specs in Chapter 3 for additional details.) TB
can be configured to sense either positive-going or nega-
tive-going transitions.
Note that TCNT2 can not operate in the “Pulse Accumulate”
or “External Event Counter” modes of operations since the
TB input is used as a capture input. Selecting either “Pulse
Accumulate” mode or “External Event Counter” mode for
TCNT2 causes TCNT2 to stop.
However, all available clock source modes may be selected
for TCNT1. Thus it is possible to determine the number of
capture events on TB or the elapsed time between capture
events on TB by using TCNT1.
TBEN
TAPND
TBPND
TDPND
TBIEN
TAIEN
TDIEN
TATEN
Interrupt 1
Interrupt 1
Interrupt 2
Timer
Timer
Timer
www.national.com
TA
TB

Related parts for ADP315PC87570