
Input/Output (I/O) Ports
MC68HC08GR32A MC68HC08GR16A Data Sheet, Rev. 0
130
Freescale Semiconductor
PTG7–PTG0 — Port G Data Bits
These read/write bits are software-programmable. Data direction of each port G pin is under the control
of the corresponding bit in data direction register G. Reset has no effect on port G data.
AD23–AD16 — Analog-to-Digital Input Bits
AD23–AD16 are pins used for the input channels to the analog-to-digital converter module. The
channel select bits in the ADC status and control register define which port G pin will be used as an
ADC input and overrides any control from the port I/O logic by forcing that pin as the input to the analog
circuitry.
NOTE
Care must be taken when reading port G while applying analog voltages to
AD23–AD16 pins. If the appropriate ADC channel is not enabled, excessive
current drain may occur if analog voltages are applied to the PTGx/ADx pin,
while PTG is read as a digital input during the CPU read cycle. Those ports
not selected as analog input channels are considered digital I/O ports.
12.8.2 Data Direction Register G
Data direction register G (DDRG) determines whether each port G pin is an input or an output. Writing a 1
to a DDRG bit enables the output buffer for the corresponding port G pin; a 0 disables the output buffer.
DDRG7–DDRG0 — Data Direction Register G Bits
These read/write bits control port G data direction. Reset clears DDRG7–DDRG0], configuring all port
G pins as inputs.
1 = Corresponding port G pin configured as output
0 = Corresponding port G pin configured as input
NOTE
Avoid glitches on port G pins by writing to the port G data register before
changing data direction register G bits from 0 to 1.
Address:
$0441
Bit 7
6
5
4321
Bit 0
Read:
PTG7
PTG6
PTG5
PTG4
PTG3
PTG2
PTG1
PTG0
Write:
Reset:
Unaffected by reset
Alternate Function:
AD23
AD22
AD21
AD20
AD19
AD18
AD17
AD16
Figure 12-23. Port G Data Register (PTG)
Address:
$0445
Bit 7
654321
Bit 0
Read:
DDRG7
DDRG6
DDRG5
DDRG4
DDRG3
DDRG2
DDRG1
DDRG0
Write:
Reset:
00000000
Figure 12-24. Data Direction Register G (DDRG)