Académique Documents
Professionnel Documents
Culture Documents
General-purpose microprocessor
CPU
GeneralPurpose
Microprocessor
Data Bus
RAM
ROM
I/O
Port
Address Bus
General-Purpose Microprocessor System
Timer
Serial
COM
Port
Microcontroller :
A smaller
computer
On-chip RAM, ROM, I/O ports...
Example Motorolas 6811, Intels 8051, Zilogs Z8 and PIC 16X
CPU
I/O
Port
RAM ROM
Serial
Timer COM
Port
A single chip
Microcontroller
Microprocessor
Microcontroller
In
This
CPU
So where is the
Input/Output?
here
Input
Output
Buses
Harvard architecture
The
Instruction
Different
Harvard architecture
address
data memory
data
address
program memory
data
PC
CPU
Von Neumann
Harvard
A Harvard architecture
computer can thus be faster
CISC Processor
RISC Processor
x. One 16-bit program counter and One 16-bit DPTR ( data pointer)
and
23
I/O PORTS
(1)
(2) One of the most useful features of the 8051 is four bidirectional I/O
ports.
(3) Each port has an 8-bit latch in the SFR space as mentioned earlier.
(4)To reduce the overall package pin count, the 8051 employs multiple
functions for each port.
(5) Each port also has an output drive and an input buffer.
(6) These ports can be used to general purpose I/O, as an address and data
lines.
(7) The four 8-bit I/O ports P0, P1, P2 and P3 each uses 8 pins
I/O PORTS
27
PORT 0
(1) Port 0 is 8-bitbidirectional I/O port.
Port 0 is also the multiplexed low-order address and data bus during
accesses to external program and data memory.
(2) If external memory is used, these port pins are used for the lower
address byte address/data (AD0-AD7), otherwise all bits of the port are
either input or output.
(3) ALE indicates whether P0 has address or data. When ALE = 0, it
provides data D0-D7, and when ALE =1 it provides address and data
with the help of a 74LS373 latch
(4) Unlike other ports, Port 0 is not provided with pull-up resistors
internally ,so for PORT0 pull-up resistors of nearly 10k are to be
connected externally as shown in the fig
28
PORT 1
(1)
PORT 2
(1)Port 2 is an 8-bit bidirectional I/O port.
(2)Port 2 emits the high-order address byte (A8-A15) during fetches from
external program memory and during accesses to external data
memory that use 16-bit addresses (MOVX @DPTR). While P0 provides
the lower 8 bits via A0-A7, it is the job of P2 to provide bits A8-A15 of
the address.
29
PORT 2
(1)Port 2 is an 8-bit bidirectional I/O port.
(2)Port 2 emits the high-order address byte (A8-A15) during fetches from
external program memory and during accesses to external data
memory that use 16-bit addresses (MOVX @DPTR). While P0 provides
the lower 8 bits via A0-A7, it is the job of P2 to provide bits A8-A15 of
the address.
PORT 3
(1)
(2)
30
Ports
31
D Latch:
A Pin of Port 1
Read latch
TB2
Vcc
Load(L1)
Internal CPU
bus
Write to latch
Clk
P1.X
pin
P1.X
Q
M1
TB1
Read pin
P0.x
Read latch
1.
TB2
2. MOV A,P1
Vcc
external pin=High
Load(L1)
P1.X
Write to latch
Clk
TB1
Read pin
3. Read pin=1 Read latch=0
Write to latch=1
M1
P1.X pin