ht82k72e Holtek Semiconductor Inc., ht82k72e Datasheet - Page 15

no-image

ht82k72e

Manufacturer Part Number
ht82k72e
Description
Ht82k72e/ht82k72a -- One Channel Keyboard With R-f Type Mcu
Manufacturer
Holtek Semiconductor Inc.
Datasheet
Timer Registers - TMRH, TMRL
The TMRH and TMRL registers are two 8-bit special
function register locations within the special purpose
Data Memory where the actual timer value is stored.
The value in the timer registers increases by one each
time an internal clock pulse is received or an external
transition occurs on the PA2/TMR pin. The timer will
count from the initial value loaded by the preload regis-
ter to the full count value of FFFFH at which point the
timer overflows and an internal interrupt signal gener-
ated. The timer value will then be reset with the initial
preload register value and continue counting. For a
maximum full range count of 00H to FFFFH the preload
registers must first be cleared to 00H. It should be noted
that after power-on the preload registers will be in an un-
known condition. Note that if the Timer/Event Counter is
not running and data is written to its preload registers,
this data will be immediately written into the actual coun-
ter. However, if the counter is enabled and counting, any
new data written into the preload registers during this
period will remain in the preload registers and will only
be written into the actual counter the next time an over-
flow occurs.
Accessing these registers is carried out in a specific
way. It must be noted that when using instructions to
preload data into the low byte register, namely TMRL,
the data will only be placed in a low byte buffer and not
directly into the low byte register. The actual transfer of
the data into the low byte register is only carried out
when a write to its associated high byte register, namely
TMRH, is executed. On the other hand, using instruc-
tions to preload data into the high byte timer register will
result in the data being directly written to the high byte
register. At the same time the data in the low byte buffer
Rev. 1.00
Timer/Event Counter Control Register
15
will be transferred into its associated low byte register.
For this reason, when preloading data into the 16-bit
timer registers, the low byte should be written first. It
must also be noted that to read the contents of the low
byte register, a read to the high byte register must first
be executed to latch the contents of the low byte buffer
from its associated low byte register. After this has been
done, the low byte register can be read in the normal
way. Note that reading the low byte timer register di-
rectly will only result in reading the previously latched
contents of the low byte buffer and not the actual con-
tents of the low byte timer register.
Timer Control Register - TMRC
The flexible features of the Holtek microcontroller
Timer/Event Counters enable them to operate in three
different modes, the options of which are determined by
the contents of the Timer Control Register TMRC. To-
gether with the TMRL and TMRH registers, these three
registers control the full operation of the Timer/Event
Counter. Before the timer can be used, it is essential that
the TMRC register is fully programmed with the right
data to ensure its correct operation, a process that is
normally carried out during program initialisation.
To choose which of the three modes the timer is to oper-
ate in, the timer mode, the event counting mode or the
pulse width measurement mode, bits TM0 and TM1
must be set to the required logic levels. The timer-on bit
TON or bit 4 of the TMRC register provides the basic
on/off control of the timer, setting the bit high allows the
counter to run, clearing the bit stops the counter. If the
timer is in the event count or pulse width measurement
mode the active transition edge level type is selected by
the logic level of the TE or bit 3 of the TMRC register.
HT82K72E/HT82K72A
February 20, 2008

Related parts for ht82k72e