
Timer Control Unit
8-1
CHAPTER
8
TIMER CONTROL UNIT
8.1
OVERVIEW
There are three 16-bit programmable timers in the Am186ES and Am188ES
microcontrollers. Timers 0 and 1 are highly versatile and are each connected to two external
pins (each one has an input and an output). These two timers can be used to count or time
external events, or they can be used to generate nonrepetitive or variable-duty-cycle
waveforms.
Timer 2 is not connected to any external pins. It can be used for real-time coding and
time-delay applications. It can also be used as a prescale to timer 0 and timer 1 or as a
DMA request source.
8.2
PULSE WIDTH DEMODULATION
For many applications, such as bar-code reading, it is necessary to measure the width of
a signal in both its High and Low phases. The Am186ES and Am188ES microcontrollers
provide a pulse-width demodulation (PWD) option to fulfill this need. The PWD bit in the
system configuration register (SYSCON) enables the PWD option. Please note that the
Am186ES and Am188ES microcontrollers do not support analog-to-digital conversion.
In PWD mode, TMRIN0, TMRIN1, INT2, and INT4 are configured internal to the
microcontroller to support the detection of rising and falling edges on the PWD input pin
(INT2/INTA0/PWD) and to enable either timer 0 when the signal is High or timer 1 when
the signal is Low. The INT4, TMRIN0, and TMRIN1 pins are not used in PWD mode and
so are available for use as PIOs.
The following diagram shows the behavior of a system for a typical waveform.
Figure 8-1
Typical Waveform Behavior
The interrupt service routine (ISR) for the INT2 and INT4 interrupts should examine the
current count of the associated timer, timer 1 for INT2 and timer 0 for INT4, in order to
determine the pulse width. The ISR should then reset the timer count register in preparation
for the next pulse.
Since the timers count at one quarter of the processor clock rate, this determines the
maximum resolution that can be obtained. Further, in applications where the pulse width
may be short, it may be necessary to poll the INT2 and INT4 request bits in the interrupt
request register in order to avoid the overhead involved in taking and returning from an
interrupt. Overflow conditions, where the pulse width is greater than the maximum count
of the timer, can be detected by monitoring the Maximum Count (MC) bit in the associated
timer or by setting the INT bit to enable timer interrupt requests.
INT2
INT4
INT2
Ints generated
TMR1 enabled
TMR0 enabled
Summary of Contents for Am186 ES
Page 1: ...Am186 ES and Am188 ES User s Manual...
Page 4: ...iv...
Page 12: ...Table of Contents xii...
Page 22: ...Features and Performance 1 8...
Page 60: ...System Overview 3 28...
Page 84: ...Chip Select Unit 5 14...
Page 132: ...Timer Control Unit 8 8...
Page 166: ...Programmable I O Pins 11 6...
Page 184: ...Register Summary A 18...