Programmable Timers
Am186™CC/CH/CU Microcontrollers User’s Manual
10-7
As shown in Figure 10-1 on page 10-1, entering pulse width demodulation mode by setting
the PWD bit in the SYSCON register does not have any direct effect on the timer block
other than to reroute the TMRIN0 and TMRIN1 signals. The timers retain their full
functionality and programmability.
In the typical pulse width demodulation application, configure the T0CON and T1CON
registers with a write of C001h (EN + INH + CONT). The ISR for Channel 13 reads the
value in T1CNT to determine the length of the Low phase of the signal, and then resets the
T1CNT register to zero. The interrupt service routine (ISR) for Channel 12 reads the value
in T0CNT to determine the length of the High phase of the signal and then resets the T0CNT
register to zero. Set the TxCMPA compare value high enough to ensure that the signal
duration will not exceed the maximum count. The ISR should check the MC bit of the
associated timer to determine if the maximum count has been exceeded. If the MC bit is
set, software must then determine the appropriate response to this overflow situation. It
may be sufficient to add the TxCMPA register value to the TxCNT register value to generate
the correct signal duration.
10.5.7.1
Handling Short Signal Durations
In applications where the pulse width is short, it may be necessary to poll the interrupt
request bits in the interrupt request (REQST) register and jump to the ISR rather than
actually taking interrupts.
10.5.7.2
Handling Long Signal Durations
When the timers are configured for PWD (EN + INH + CONT), the maximum duration of
each phase of the input signal should not exceed 4 • TxCMPA processor clocks because
the timer increments every fourth processor clock in this configuration. To extend the
maximum measurable duration using PWD, software can enable timer interrupts, use Timer
2 as a prescaler, or both.
If the INT (interrupt) bit is set in either T0CON or T1CON, the associated timer generates
an interrupt request on Channel 0—type 08h for Timer 0 and type 09h for Timer 1. The ISR
for these interrupts should add the programmed maxcount (the value of the TxCMPA
register) to a memory location and clear the MC bit in the TxCON register each time the
interrupt is taken. The ISR for channel 13 (interrupt type 1dh) must add the value of the
Timer 1 memory location to the current T1CNT register to determine the duration of the
Low phase of the signal. The ISR for channel 12 (interrupt type 1ch) must add the value of
the Timer 0 memory location to the current T0CNT register to determine the duration of
the High phase of the signal. In both cases the calculated duration must be multiplied by
four to yield the total number of processor clocks.
If the P (prescaler) bit is set in either T0CON or T1CON, the associated timer increments
once for each Timer 2 time-out. This increases the maximum measurable duration to
4 • T2CMPA • TxCMPA. However, the precision of the measurement falls from within four
processor clocks of the actual value to within 4 • T2CMPA processor clocks of the actual
value. For this reason, the value of T2CMPA should be kept as small as possible. This
solution uses fewer processor cycles and has less of an effect on system performance than
the use of timer interrupts.
In applications where extremely long signals need to be measured, both the P bit and the
INT bit can be set either in T0CON or T1CON or both.
Содержание Am186 CC
Страница 1: ...Am186 CC CH CU Microcontrollers User s Manual Order 21914B...
Страница 4: ...iv Am186 CC CH CU Microcontrollers User s Manual...
Страница 18: ...Table of Contents xviii Am186 CC CH CU Microcontrollers User s Manual...
Страница 24: ...Introduction xxiv Am186 CC CH CU Microcontrollers User s Manual...
Страница 39: ...Architectural Overview Am186 CC CH CU Microcontrollers User s Manual 1 15 Figure 1 6 32 Channel Linecard CH CC...
Страница 40: ...Architectural Overview 1 16 Am186 CC CH CU Microcontrollers User s Manual...
Страница 86: ...System Overview 3 36 Am186 CC CH CU Microcontrollers User s Manual...
Страница 92: ...Emulator Support 4 6 Am186 CC CH CU Microcontrollers User s Manual...
Страница 112: ...DRAM Controller 6 8 Am186 CC CH CU Microcontrollers User s Manual...
Страница 134: ...Interrupts 7 22 Am186 CC CH CU Microcontrollers User s Manual...
Страница 186: ...Programmable I O Signals 9 8 Am186 CC CH CU Microcontrollers User s Manual...
Страница 200: ...Watchdog Timer 11 6 Am186 CC CH CU Microcontrollers User s Manual...
Страница 232: ...Asynchronous Serial Ports UARTs 13 24 Am186 CC CH CU Microcontrollers User s Manual...
Страница 242: ...Synchronous Serial Port SSI 14 10 Am186 CC CH CU Microcontrollers User s Manual...
Страница 264: ...High Level Data Link Control HDLC 15 22 Am186 CC CH CU Microcontrollers User s Manual...
Страница 332: ...Universal Serial Bus USB 18 34 Am186 CC CH CU Microcontrollers User s Manual...
Страница 348: ...Register Summary A 16 Am186 CC CH CU Microcontrollers User s Manual...
Страница 376: ...Index Index 18 Am186 CC CH CU Microcontrollers User s Manual...