English
Language : 

MC9S12KG128_10 Datasheet, PDF (171/606 Pages) Freescale Semiconductor, Inc – HCS12 Microcontrollers
Chapter 4 Port Integration Module (PIM9KG128V1)
4.4 Functional Description
Each pin can act as general purpose I/O. In addition the pin can act as an output from a peripheral module
or an input to a peripheral module. Table 4-42 summarizes the priority in case of multiple enabled modules
trying to control a shared port.
Table 4-42. Summary of Functional Priority
Port
T
S
M
P
H
J
1 Highest priority >... > lowest priority
Priority1
TIMER > GPIO
SCI0, SCI1, SPI0 > GPIO
CAN0 > GPIO
CAN0 (routed) > SPI0 (routed) > GPIO
CAN0 (routed) > CAN4 (routed) > SPI0 (routed) > GPIO
CAN4 (routed) > GPIO
PWM > SPI1, SPI2 > GPIO
SPI1, SPI2 > GPIO
CAN4 > IIC > GPIO
A set of configuration registers is common to all ports. All registers can be written at any time, however a
specific configuration might not become active.
Example:
A selected pull-up resistor does not become active while the port is used as a push-pull output.
4.4.1 I/O Register
The I/O Register holds the value driven out to the pin if the port is used as a general-purpose I/O. Writing
to the I/O Register only has an effect on the pin if the port is used as general-purpose output.
When reading the I/O Register, the value of each pin is returned if the corresponding Data Direction
Register bit is set to 0 (pin configured as input). If the data direction register bits is set to 1, the content of
the I/O Register bit is returned. This is independent of any other configuration (Figure 4-47).
Due to internal synchronization circuits, it can take up to 2 bus cycles until the correct value is read on the
I/O Register when changing the data direction register.
4.4.2 Input Register
The Input Register is a read-only register and generally returns the value of the pin (Figure 4-47). It can
be used to detect overload or short circuit conditions.
Due to internal synchronization circuits, it can take up to 2 bus cycles until the correct value is read on the
Input Register when changing the Data Direction Register.
MC9S12KG128 Data Sheet, Rev. 1.16
Freescale Semiconductor
171