English
Language : 

MC9S12KG128 Datasheet, PDF (158/600 Pages) Freescale Semiconductor, Inc – Microcontrollers
Chapter 4 Port Integration Module (PIM9KG128V1)
4.3.4 Port P Registers
Port P is associated with the Pulse Width Modulator (PWM) and two serial peripheral interfaces (SPI1,
SPI2). Each pin is assigned to these modules according to the following priority: PWM > SPI2/SP1 >
general-purpose I/O.
When a PWM channel is enabled, the corresponding pin becomes a PWM output with the exception of of
pin 7 which can be PWM input or output. Refer to the PWM block description chapter for information on
enabling and disabling the PWM channels.
When SPI2 is enabled and the corresponding PWM channels are disabled, the respective pin configuration
for PP[7:4] is determined by several status bits in the SPI2 module. When SPI1 is enabled and the
corresponding PWM channels are disabled, the respective pin configuration for PP[3:0] is determined by
several status bits in the SPI1 module. Refer to the SPI block description chapter for information on
enabling and disabling the SPI. The SPI1 and SPI2 pins can be re-routed. Refer to Section 4.3.3.8,
“Module Routing Register (MODRR)”.
During reset, port P pins are configured as high-impedance inputs.
4.3.4.1 Port P I/O Register (PTP)
Module Base + 0x0018
7
R
PTP7
W
6
PTP6
5
PTP5
4
PTP4
3
PTP3
2
PTP2
PWM PWM7
PWM6
PWM5
PWM4
PWM3
PWM2
SPI SCK2
SS2
MOSI2
MISO2
SS1
SCK1
Reset
0
0
0
0
0
0
Figure 4-23. Port P I/O Register (PTP)
Read: Anytime. Write: Anytime.
1
PTP1
PWM1
MOSI1
0
0
PTP0
PWM0
MISO1
0
If the data direction bits of the associated I/O pins are set to 1, a read returns the value of the port register,
otherwise the value at the pins is read.
The PWM function takes precedence over the general purpose I/O function if the associated PWM channel
is enabled. While channels 6-0 are output only if the respective channel is enabled, channel 7 can be PWM
output or input if the shutdown feature is enabled.
The SPI function takes precedence over the general purpose I/O function associated with if enabled. If both
PWM and SPI are enabled the PWM functionality takes precedence.
MC9S12KG128 Data Sheet, Rev. 1.15
158
Freescale Semiconductor