6 - 7
6
MSM66587 Family User's Manual
Chapter 6 Port Functions
6.2
Port Control Registers
There are four types of port control registers.
- Port Data Registers (Pn: n = 0-2, 4-10, 12)
- Port Mode Registers (PnIO: n = 0-2, 4-10, 12)
- Port Secondary Control Registers (PnSF: n = 1, 2, 4-7, 9, 12)
- Port Pull-Up Control Registers (PnPUP: n = 0, 1, 4, 9, 10)
These registers are allocated as SFRs. Table 6-2 lists the port control registers.
6.2.1
Port Data Registers (Pn: n = 0-2, 4-10, 12)
Port Data Registers (Pn: n = 0-2, 4-10, 12) are 8-bit registers that store port output data. However,
Port 5 has a 2-bit register, and Port 6 has a 6-bit register.
Pn are allocated as SFRs. After reset (by RES signal input, BRK instruction execution, op code
trap) the contents of P0-P2, P4, P7-P10, and P12 will be 00H, the contents of P5, and P6 will be
undefind.
When a read instruction is executed for a port, it will read the pin state ("0" or "1") if it has been
specified as an input port, or it will read the contents of Pn ("0" or "1") if it has been specified as
an output port. When a write instruction is executed for a port, data will be written to Pn regardless
of the input/output specification.
6.2.2
Port Mode Registers (PnIO: n = 0-2, 4-10, 12)
Port Mode Registers (PnIO: n = 0-2, 4-10, 12) are 8-bit registers that specify whether ports are
input or output. However, Port 5 has a 2-bit register, and Port 6 has a 6-bit register.
PnIO are allocated as SFRs. After reset (by RES signal input, BRK instruction execution, op code
trap) the contents of P0IO-P2IO, P4IO, P7IO-P10IO, and P12IO will be 00H, and the contents of
P5IO, and P6IO will be undefind.
When a PnIO bit is 0, the port will enter input mode. When 1, the port will enter output mode.
However, if the Port Secondary Function Control Register (PnSF: n = 0-2 , 4-7, 9, 12) explained
next has been set to 1 to select secondary function, then the PnIO specification will be disabled.
6.2.3
Port Secondary Function Control Registers (PnSF: n = 1, 2, 4-7, 9, 12)
Port Secondary Function Control Registers (PnSF: n = 1, 2, 4-7, 9, 12) are 8-bit registers that
specify whether ports operate as their primary or secondary function. However, Port 2 has a 2-
bit register, Port 5 has a 2-bit register, Port 6 has a 6-bit register, Port 7 has a 5-bit register, Port
9 has a 4-bit register, and Port 12 has a 2-bit register.
PnSF are allocated as SFRs. After reset (by RES signal input, BRK instruction execution, op code
trap) the contents of P1SF, P4SF, P6SF, P7SF, P9SF, and P12SF will be 00H, the contents of P2SF
will be 80H, and the contents of P5SF will be CFH. This selects the primary function for all ports.
When a PnSF bit is "0", the port’s primary function will be selected. When "1", the port’s secondary
function will be selected.
For Port 0 the primary/secondary function select is performed
automatically by hardware, so it has not Port Secondary Function Control Register.