Hardware manual
Rev. 3.0, 09/98, page 96 of 361
6.5 Port 4
Port 4 is an 8-bit input/output port that also provides the input and output pins for the 8-bit timers
and the output pins for the PWM timers. The pin functions depend on control bits in the control
registers of the timers. Pins not used by the timers are available for general-purpose input/output.
Table 6.11 lists the pin functions, which are the same in both the expanded and single-chip modes.
Table 6.11 Port 4 Pin Functions (Modes 1 to 3)
Usage Pin Functions
I/O port P4
0
P4
1
P4
2
P4
3
P4
4
P4
5
P4
6
P4
7
Timer TMCI
0
TMO
0
TMRI
0
TMCI
1
TMO
1
TMRI
1
PW
0
PW
1
See section 7, “8-Bit Timers” and section 8, “PWM Timers,” for details of the timer control bits.
Pins of port 4 can drive a single TTL load and a 90pF capacitive load when they are used as output
pins. They can also drive a Darlington pair.
Table 6.12 details the port 4 registers.
Table 6.12 Port 4 Registers
Name Abbreviation Read/Write Initial Value Address
Port 4 data direction register P4DDR W H'00 H'FFB5
Port 4 data register P4DR R/W H'00 H'FFB7
Port 4 Data Direction Register (P4DDR)H'FFB5
Bit:76543210
P4
7
DDR P4
6
DDR P4
5
DDR P4
4
DDR P4
3
DDR P4
2
DDR P4
1
DDR P4
0
DDR
Initial value:00000000
Read/Write: W W W W W W W W
P4DDR is an 8-bit register that selects the direction of each pin in port 4. A pin functions as an
output pin if the corresponding bit in P4DDR is set to “1,” and as an input pin if the bit is cleared
to “0.”