Input/Output (I/O) Ports
Data Sheet
MC68HC08AS32A — Rev. 1
158
Input/Output (I/O) Ports
MOTOROLA
12.3 Port B
Port B is an 8-bit special-function port that shares all of its pins with the
analog-to-digital converter (ADC).
12.3.1 Port B Data Register
The port B data register contains a data latch for each of the eight port B pins.
PTB[7:0] — Port B Data Bits
These read/write bits are software programmable. Data direction of each port B
pin is under the control of the corresponding bit in data direction register B.
Reset has no effect on port B data.
ATD[7:0] — ADC Channels
PTB7/ATD7–PTB0/ATD0 are eight of the 15 analog-to-digital converter
channels. The ADC channel select bits, CH[4:0], determine whether the
PTB7/ATD7–PTB0/ATD0 pins are ADC channels or general-purpose I/O pins.
If an ADC channel is selected and a read of this corresponding bit in the port B
data register occurs, the data will be 0 if the data direction for this bit is
programmed as an input. Otherwise, the data will reflect the value in the data
latch. (See
Section 3. Analog-to-Digital Converter (ADC)
.) Data direction
register B (DDRB) does not affect the data direction of port B pins that are being
used by the ADC. However, the DDRB bits always determine whether reading
port B returns to the states of the latches or logic 0.
Table 12-1. Port A Pin Functions
DDRA
Bit
PTA
Bit
I/O Pin Mode
Accesses
to DDRA
Accesses to PTA
Read/Write
Read
Write
0
X
Input, Hi-Z
DDRA[7:0]
Pin
PTA[7:0]
(1)
1
X
Output
DDRA[7:0]
PTA[7:0]
PTA[7:0]
X = Don’t Care
Hi-Z = High Impedance
1. Writing affects data register, but does not affect input.
Address:
$0001
Bit 7
6
5
4
3
2
1
Bit 0
Read:
PTB7
PTB6
PTB5
PTB4
PTB3
PTB2
PTB1
PTB0
Write:
Reset:
Unaffected by reset
Alternate
Functions:
ATD7
ATD6
ATD5
ATD4
ATD3
ATD2
ATD1
ATD0
Figure 12-5. Port B Data Register (PTB)
F
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
.