|
MC68HC05X16 Datasheet, PDF (60/232 Pages) Freescale Semiconductor, Inc – High-density complementary metal oxide semiconductor HCMOS) microcontroller unit | |||
|
◁ |
Freescale Semiconductor, Inc.
4.5.5 Data direction registers (DDRA, DDRB and DDRC)
Port A data direction (DDRA)
Port B data direction (DDRB)
Port C data direction (DDRC)
Address bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
State
on reset
$0004
0000 0000
$0005
0000 0000
$0006
0000 0000
4
Writing a â1â to any bit conï¬gures the corresponding port pin as an output; conversely, writing any
bit to â0â conï¬gures the corresponding port pin as an input.
Reset clears these registers, thus conï¬guring all ports as inputs.
4.6
Other port considerations
All output ports can emulate âopen-drainâ outputs. This is achieved by writing a zero to the relevant
output port latch. By toggling the corresponding data direction bit, the port pin will either be an
output zero or tri-state (an input). This is shown diagrammatically in Figure 4-3.
When using a port pin as an âopen-drainâ output, certain precautions must be taken in the user
software. If a read-modify-write instruction is used on a port where the âopen-drainâ is assigned and
the pin at this time is programmed as an input, it will read it as a âoneâ. The read-modify-write
instruction will then write this âoneâ into the output data latch on the next cycle. This would cause
the âopen-drainâ pin not to output a âzeroâ when desired.
Note: âOpen-drainâ outputs should not be pulled above VDD.
INPUT/OUTPUT PORTS
MC68HC05X16
For More Information On This Product,
Rev. 1
Go to: www.freescale.com
|
▷ |