Chapter 1 Hardware Structure
Timer/Event Counters
The provision of timers forms an important part of any microcontroller giving the designer a means
of carrying out time related functions. The devices in the LCD Type MCU series contain either one,
two or three count up timers of either 8 or 16-bit capacity depending upon which device is se-
lected. As each timer has three different operating modes, they can be configured to operate as a
general timer, an external event counter or as a pulse width measurement device.
There are two types of registers related to the Timer/Event Counters. The first is the register that
contains the actual value of the timer and into which an initial value can be preloaded. Reading
from this register retrieves the contents of the Timer/Event Counter. The second type of associ-
ated register is the timer control register which defines the timer options and determines how the
timer is to be used. The timer clock source can be configured to come from the internal clock
source or from the external timer pin. The accompanying table lists the associated timer register
names.
HT49R30A-1
HT49C30-1
HT49C30L
No. of 8-bit Timers
Timer Register Name
Timer Control Register
No. of 16-bit Timers
Timer Register Name
Timer Control Register
1
TMR
TMRC
¾
¾
¾
HT49R50A-1
HT49C50-1
HT49C50L
2
TMR0/TMR1
TMR0C/TMR1C
¾
¾
¾
HT49R70A-1
HT49C70-1
HT49C70L
1
TMR0
TMR0C
1
TMR1L/TMR1H
TMR1C
HT49RU80
HT49CU80
1
TMR0
TMR0C
2
TMR1L/TMR1H
TMR2L/TMR2H
TMR1C
TMR2C
An external clock source is used when the timer is in the event counting mode, the clock source be-
ing provided on the external timer pin known as TMR, TMR0, TMR1 or TMR2 depending on which
device is selected. These external pins are pin-shared with Port B Input pins. Depending upon the
condition of the TE, T0E, T1E or T2E bit in the corresponding timer control register, each high to
low, or low to high transition on the external timer input pin will increment the counter by one.
Configuring the Timer/Event Counter Input Clock Source
The internal timer¢s clock can originate from various sources, depending upon which device and
which timer is chosen. The internal clock input timer source is used when the timer is in the timer
mode or in the pulse width measurement mode. This internal clock source can originate from ei-
ther the system clock, the system clock/4, the RTC clock, the Time Base or the Timer/Event Coun-
ter 0 overflow depending upon the timer chosen, on which configuration options are selected and
upon how the counter is configured by the application program.
An external clock source is used when the timer is in the event counting mode, the clock source be-
ing provided on an external timer pin, TMR, TMR0, TMR1 or TMR2 depending upon which device
and which timer is used. Depending upon the condition of the TE, T0E, T1E or T2E bit, each high
to low, or low to high transition on the external timer pin will increment the counter by one.
59
Home Index Bookmark Pages Text
Previous Next
Pages: Home Index