Parallel Input/Output
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
76
Freescale Semiconductor
The TPM can be congured to use PTD6 as either an input capture, output compare, PWM, or external
as a timer pin.
6.3.5
Port E
Figure 6-5. Port E Pin Names
Port E is an 8-bit general-purpose I/O port.
Port E pins are available as general-purpose I/O pins controlled by the port E data (PTED), data direction
information about general-purpose I/O control.
6.4
Parallel I/O Controls
Provided no on-chip peripheral is controlling a port pin, the pins operate as general-purpose I/O pins that
are accessed and controlled by a data register (PTxD), a data direction register (PTxDD), and a pullup
enable register (PTxPE) where x is A, B, C, D, or E.
Reads of the data register return the pin value (if PTxDDn = 0) or the contents of the port data register (if
PTxDDn = 1). Writes to the port data register are latched into the port register whether the pin is controlled
by an on-chip peripheral or the pin is congured as an input. If the corresponding pin is not controlled by
a peripheral and is congured as an output, this level will be driven out the port pin.
6.4.1
Data Direction Control
The data direction control bits determine whether the pin output driver is enabled, and they control what
is read for port data register reads. Each port pin has a data direction control bit. When PTxDDn = 0, the
corresponding pin is an input and reads of PTxD return the pin value. When PTxDDn = 1, the
corresponding pin is an output and reads of PTxD return the last value written to the port data register.
When a peripheral module or system function is in control of a port pin, the data direction control still
controls what is returned for reads of the port data register, even though the peripheral system has
overriding control of the actual pin direction.
For the MC9S08RC/RD/RE/RG MCU, reads of PTD0/BKGD/MS and PTD1/RESET will return the value
on the output pin.
It is a good programming practice to write to the port data register before changing the direction of a port
pin to become an output. This ensures that the pin will not be driven with an old data value that happened
to be in the port data register.
Port E
Bit 7
654321
Bit 0
MCU Pin:
PTE7
PTE6
PTE5
PTE4
PTE3
PTE2
PTE1
PTE0