ht82j30r Holtek Semiconductor Inc., ht82j30r Datasheet - Page 16

no-image

ht82j30r

Manufacturer Part Number
ht82j30r
Description
Ht82j30r/ht82j30a -- 16 Channel A/d Mcu With Spi Interface
Manufacturer
Holtek Semiconductor Inc.
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
HT82J30R
Manufacturer:
HOLTEK
Quantity:
155
Timer Register - TMR
The TMR register is an 8-bit special function register lo-
cation 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
PA4/TMR pin. The timer will count from the initial value
loaded by the preload register to the full count value of
FFH at which point the timer overflows and an internal
interrupt signal generated. 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 FFH
the preload register must first be cleared to 00H. It
should be noted that after power-on the preload register
will be in an unknown condition. Note that if the
Timer/Event Counter is not running and data is written to
its preload register, this data will be immediately written
into the actual counter. However, if the counter is en-
abled and counting, any new data written into the
preload register during this period will remain in the
preload register and will only be written into the actual
counter the next time an overflow occurs.
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 TMR register, these two registers control
the full operation of the Timer/Event Counter. Before the
Rev. 1.10
Timer/Event Counter Control Register
16
timer can be used, it is essential that the TMRC register
is fully programmed with the right data to ensure its cor-
rect 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. Bits
0~2 of the TMRC register determine the division ratio of
the input clock prescaler. The prescaler bit setting has
no effect if an external clock source is used. 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.
Configuring the Timer Mode
In this mode, the timer can be utilised to measure fixed
time intervals, providing an internal interrupt signal each
time the counter overflows. To operate in this mode, bits
TM1 and TM0 of the TMRC register must be set to 1 and
0 respectively. In this mode, the internal clock is used as
the timer clock. The input clock frequency to the timer is
f
prescaler, the value of which is determined by bits
PSC0~PSC2 of the TMRC register. The timer-on bit,
TON, must be set high to enable the timer to run. Each
time an internal clock high to low transition occurs, the
SYS
divided by the value programmed into the timer
HT82J30R/HT82J30A
March 13, 2008

Related parts for ht82j30r