Escolar Documentos
Profissional Documentos
Cultura Documentos
Buses
Microprocessors & Interfacing Computer buses
I/O Addressing
Memory mapped I/O
Buses and Parallel Separate I/O
Input/Output Parallel Input/Output
AVR examples
G A Y Open D Q
Collector Destination or
0 0 0 74116 Dual 4-bit
Output Device
0 1 1 Latch with Clear
1 0 X Clock
1 1 X C1
High
Impedance C2 CLR
To/From
CPU
Data Bus
S2, 2008 COMP9032 Week5 11 S2, 2008 COMP9032 Week5 12
Address Decoding for Output
CPU Timing Signals
Devices
74LS139
2-of-4 CPU must provide timing and synchronization
Decoder
A1
A1
so that the transfer of information occurs at
From
CPU A0 O0 the right time.
A0 O1
Write O2
CPU has its own clock.
Control E
O3 I/O devices may have a separate I/O clock.
Typical timing signals include READ and WRITE.
To/From
CPU
Data Bus
S2, 2008 COMP9032 Week5 13 S2, 2008 COMP9032 Week5 14
A1
A1 DES_ADR_OK
A0 O0
A0 O1
WRITE O2
E
O3
I/O
WRITE
Information Source
input device
Data Bus
Each port pin consists of three register bits When the pin is configured as an input pin,
DDxn, PORTxn, and PINxn. the pull-up resistor can be
DDxn bits are accessed at the DDRx I/O address, activated/deactivated.
PORTxn bits at the PORTx I/O address
To active pull-up resistor for input pin,
PINxn bits at the PINx I/O address.
PORTxn needs to be written logic one.
The DDxn bit in the DDRx Register selects
the direction of this pin.
If DDxn is written logic one, Pxn is configured as
an output pin. If DDxn is written logic zero, Pxn is
configured as an input pin.
.include m64def.inc
ser r16
out DDRB, r16 ; set Port B for output