HT48R063B/064B/065B/066B
I/O Port Control Registers
control register, must setup the pin as an output to en-
able the PFD, PFD output. If the port control register
has setup these pins as input, then these pins will
function as normal logic input with the usual pull-high
selection, even if the PFD function has been selected.
Each Port has its own control register, known as PAC,
PBC, PCC, PDC, PEC, PFC which controls the in-
put/output configuration. With this control register, each
I/O pin with or without pull-high resistors can be recon-
figured dynamically under software control. For the I/O
pin to function as an input, the corresponding bit of the
control register must be written as a ²1². This will then
allow the logic state of the input pin to be directly read by
instructions. When the corresponding bit of the control
register is written as a ²0², the I/O pin will be setup as a
CMOS output. If the pin is currently setup as an output,
instructions can still be used to read the output register.
However, it should be noted that the program will in fact
only read the status of the output data latch and not the
actual logic status of the output pin.
·
SCOM Driver Pins
Pins PB0~PB3 on Port B can be used as LCD COM
driver pins. This function is controlled using the
SCOMC register which will generate the necessary
1/2 bias signals on these four pins.
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.
Pin-shared Functions
Programming Considerations
The flexibility of the microcontroller range is greatly en-
hanced by the use of pins that have more than one func-
tion. Limited numbers of pins can force serious design
constraints on designers but by supplying pins with
multi-functions, many of these difficulties can be over-
come. For some pins, the chosen function of the
multi-function I/O pins is set by configuration options
while for others the function is set by application pro-
gram control.
Within the user program, one of the first things to con-
sider is port initialisation. After a reset, the I/O data reg-
ister and I/O 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
port control registers, are then programmed to setup
some pins as outputs, these output pins will have an ini-
tial high output value unless the associated port data
register is first programmed. Selecting which pins are in-
puts 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.
·
External Interrupt Input
The external interrupt pin, INT, is pin-shared with an
I/O pin. To use the pin as an external interrupt input
the correct bits in the INTCO register must be pro-
grammed. The pin must also be setup as an input by
setting the appropriate bit in the Port Control Register.
A pull-high resistor can also be selected via the appro-
priate port pull-high resistor register. Note that even if
the pin is setup as an external interrupt input the I/O
function still remains.
·
External Timer/Event Counter Input
The Timer/Event Counter pins, TC0 and TC1 are
pin-shared with I/O pins. For these shared pins to be
used as Timer/Event Counter inputs, the Timer/Event
Counter must be configured to be in the Event Coun-
ter or pulse width capture Mode. This is achieved by
setting the appropriate bits in the Timer/Event Counter
Control Register. The pins must also be setup as in-
puts by setting the appropriate bit in the Port Control
Register. Pull-high resistor options can also be se-
lected using the port pull-high resistor registers. Note
that even if the pin is setup as an external timer input
the I/O function still remains.
T
1
T
2
T
3
T
4
T
1
T
2
T
3
T
4
S
y
s
t
e
m
C
l
o
c
k
P
o
r
t
D
a
t
a
R
e
a
d
f
r
o
m
P
o
r
t
W
r
i
t
e
t
o
P
o
r
t
Read Modify Write Timing
Pins PA0 to PA7 each have a wake-up functions, se-
lected via the PAWK register. When the device is in the
Idle/Sleep Mode, various methods are available to wake
the device up. One of these is a high to low transition of
any of the these pins. Single or multiple pins on Port A
can be setup to have this function.
·
PFD Output
The device contains a PFD function whose single or
dual outputs are pin-shared with I/O pins. The output
function of these pin are chosen using the CTRL0 reg-
ister. Note that the corresponding bit of the port
Rev. 1.00
35
April 7, 2011