Programming Considerations
Within the user program, one of the first things to consider is port initialization. After a reset, all of
the I/O data and port control registers 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 op
-
tions have been selected. If the port control registers, PAC, PBC, PCC, etc., are then programmed
to setup some pins as outputs, these output pins will have an initial high output value unless the as
-
sociated port data registers, PA, PB, PC, etc., are first programmed. Selecting which pins are in-
puts and which are outputs can be achieved byte-wide by loading the correct values into the
appropriate 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.
Port A has the additional capability of providing wake-up functions. When the chip is in the HALT
state, various methods are available to wake the device up. One of these is a high to low transition
of any of the Port A pins. Single or multiple pins on Port A can be setup to have this function.
40
I/O Type MCU
V
D D
M
U
X
R e a d D a t a R e g i s t e r
D
Q
C K
S
D
Q
C K
S
C o n t r o l B i t
D a t a B u s
W r i t e C o n t r o l R e g i s t e r
C h i p R e s e t
R e a d C o n t r o l R e g i s t e r
W r i t e D a t a R e g i s t e r
D a t a B i t
P C 1 / R X
T o U A R T R X
P u l l - H i g h
O p t i o n
U A R T E N
& R X E N
Q
Q
PC1/RX Input/Output Port - HT48RU80/HT48CU80
T 1 T 2 T 3 T 4 T 1 T 2 T 3 T 4
W r i t e t o P o r t R e a d f r o m P o r t
S y s t e m C l o c k
P o r t D a t a