ht82m72e Holtek Semiconductor Inc., ht82m72e Datasheet - Page 13

no-image

ht82m72e

Manufacturer Part Number
ht82m72e
Description
Ht82m72e/ht82m72a -- Rf One Channel Mouse 8-bit Otp Mcu
Manufacturer
Holtek Semiconductor Inc.
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Company:
Part Number:
HT82M72E
Quantity:
650
Programming Considerations
Within the user program, one of the first things to con-
sider is port initialisation. After a reset, all of the data and
port control register will be set high. This means that all
I/O pins will default to an input state, the level of which
depends on the other connected circuitry and whether
pull-high options have been selected. If the PAC,
PBC0~PBC6 and PDC0~PDC1 port control register, are
then programmed to setup some pins as outputs, these
output pins will have an initial high output value unless
the associated PA, PB0~PB6 and PD0~PD1 port data
registers are first programmed. Selecting which pins are
inputs and which are outputs can be achieved byte-wide
by loading the correct value into the port control register
or by programming individual bits in the port control reg-
ister using the SET [m].i and CLR [m].i instructions.
Note that when using these bit control instructions, a
read-modify-write operation takes place. The
microcontroller must first read in the data on the entire
port, modify it to the required new bit values and then re-
write this data back to the output ports.
PA have the additional capability of providing wake-up
functions. When the device is in the Power Down Mode,
various methods are available to wake the device up.
One of these is a high to low transition of any of the se-
lected wake-up pins.
Timer/Event Counters
The provision of timers form an important part of any
microcontroller giving the designer a means of carrying
out time related functions. The device contains an inter-
nal 16-bit count-up timer which has three operating
modes. The timer can be configured to operate as a
general timer, external event counter or as a pulse width
measurement device. The provision of an internal
Rev. 1.20
Read/Write Timing
16-bit Timer/Event Counter Structure
13
16-stage prescaler to the timer clock circuitry gives
added range to the timer.
There are three registers related to the Timer/Event
Counter, TMRL, TMRH and TMRC. The TMRL/TMRH
register pair are the registers that contains the actual
timing value. Writing to this register pair places an initial
starting value in the Timer/Event Counter preload regis-
ter while reading retrieves the contents of the
Timer/Event Counter. The TMRC register is a
Timer/Event Counter 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 system clock source or from an exter-
nal clock on shared pin PA2/TMR.
Configuring the Timer/Event Counter Input Clock
Source
The internal timer clock source can originate from either
the system clock or from an external clock source. The
system clock input timer source is used when the timer
is in the timer mode or in the pulse width measurement
mode.
An external clock source is used when the timer is in the
event counting mode, the clock source being provided
on shared pin PA2/TMR. Depending upon the condition
of the TE bit, each high to low, or low to high transition on
the PA2/TMR pin will increment the counter by one.
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
HT82M72E/HT82M72A
May 22, 2008

Related parts for ht82m72e