7.2 Port data and data direction
Reading and writing of parallel I/O is accomplished through the port data registers
(PTxD). The direction, input or output, is controlled through the input enable or output
enable registers.
After reset, all parallel I/O default to the Hi-Z state. The corresponding bit in output
enable register (PTxOE) or input enable register (PTxIE) must be configured for output
or input operation. Each port pin has an input enable bit and an output enable bit. When
PTxIEn = 1, a read from PTxDn returns the input value of the associated pin; when
PTxIEn = 0, a read from PTxDn returns the last value written to the port data register.
NOTE
The PTxOE must be clear when the corresponding pin is used
as input function to avoid contention. If set the corresponding
PTxOE and PTxIE bits at same time, read from PTxDn will
always return the output data.
When a peripheral module or system function is in control of a port pin, the data direction
register bit 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.
When a shared analog function is enabled for a pin, all digital pin functions are disabled.
A read of the port data register returns a value of 0 for any bits that have shared analog
functions enabled. In general, whenever a pin is shared with both an alternate digital
function and an analog function, the analog function has priority such that if both of the
digital and analog functions are enabled, the analog function controls the pin.
A write of valid data to a port data register must occur before setting the output enable bit
of an associated port pin. This ensures that the pin will not be driven with an incorrect
data value.
7.3 Internal pullup enable
An internal pullup device can be enabled for each port pin by setting the corresponding
bit in one of the pullup enable registers (PTxPEn). The internal pullup device is disabled
if the pin is configured as an output by the parallel I/O control logic, or by any shared
peripheral function, regardless of the state of the corresponding pullup enable register bit.
The internal pullup device is also disabled if the pin is controlled by an analog function.
Chapter 7 Parallel input/output
MC9S08PA4 Reference Manual, Rev. 5, 08/2017
NXP Semiconductors
133
Содержание MC9S08PA4
Страница 1: ...MC9S08PA4 Reference Manual Supports MC9S08PA4 Document Number MC9S08PA4RM Rev 5 08 2017 ...
Страница 2: ...MC9S08PA4 Reference Manual Rev 5 08 2017 2 NXP Semiconductors ...
Страница 22: ...MC9S08PA4 Reference Manual Rev 5 08 2017 22 NXP Semiconductors ...
Страница 28: ...System clock distribution MC9S08PA4 Reference Manual Rev 5 08 2017 28 NXP Semiconductors ...
Страница 150: ...Port data registers MC9S08PA4 Reference Manual Rev 5 08 2017 150 NXP Semiconductors ...
Страница 196: ...Human machine interfaces HMI MC9S08PA4 Reference Manual Rev 5 08 2017 196 NXP Semiconductors ...
Страница 224: ...Instruction Set Summary MC9S08PA4 Reference Manual Rev 5 08 2017 224 NXP Semiconductors ...
Страница 232: ...Functional Description MC9S08PA4 Reference Manual Rev 5 08 2017 232 NXP Semiconductors ...
Страница 258: ...FTM Interrupts MC9S08PA4 Reference Manual Rev 5 08 2017 258 NXP Semiconductors ...
Страница 268: ...Initialization application information MC9S08PA4 Reference Manual Rev 5 08 2017 268 NXP Semiconductors ...
Страница 294: ...Functional description MC9S08PA4 Reference Manual Rev 5 08 2017 294 NXP Semiconductors ...
Страница 370: ...Memory map and register description MC9S08PA4 Reference Manual Rev 5 08 2017 370 NXP Semiconductors ...
Страница 398: ...Resets MC9S08PA4 Reference Manual Rev 5 08 2017 398 NXP Semiconductors ...
Страница 400: ...MC9S08PA4 Reference Manual Rev 5 08 2017 400 NXP Semiconductors ...