ht82k72e Holtek Semiconductor Inc., ht82k72e Datasheet - Page 14

no-image

ht82k72e

Manufacturer Part Number
ht82k72e
Description
Ht82k72e/ht82k72a -- One Channel Keyboard With R-f Type Mcu
Manufacturer
Holtek Semiconductor Inc.
Datasheet
I/O Pin Structures
The diagrams illustrate the I/O pin internal structures. As
the exact logical construction of the I/O pin may differ
from these drawings, they are supplied as a guide only
to assist with the functional understanding of the I/O
pins.
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, PBC,
PCC, PDC and PE4~7 (control I/O PE0~3) 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, PB, PC, PD and PE0~3
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 register 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 en-
tire port, modify it to the required new bit values and then
rewrite this data back to the output ports.
All pins 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 selected wake-up pins.
Rev. 1.00
Read/Write Timing
16-bit Timer/Event Counter Structure
14
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
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.
Note: The timer overflow can t wake-up in halt mode.
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.
HT82K72E/HT82K72A
February 20, 2008

Related parts for ht82k72e