Post on 04-Jun-2018
8/13/2019 Lecture 4-IO Port Programming
1/19
Microprocessor System
Lecture 4 : IO Port Programming
8/13/2019 Lecture 4-IO Port Programming
2/19
PIN Diagram
8/13/2019 Lecture 4-IO Port Programming
3/19
Pins XTAL1 and XTAL2
8/13/2019 Lecture 4-IO Port Programming
4/19
Pin RST
8/13/2019 Lecture 4-IO Port Programming
5/19
D Flip-Flop
Edge-Trigger
Each pin of port 0, port 1, port 2, and
port 3 has a D Flip-Flop.
8/13/2019 Lecture 4-IO Port Programming
6/19
Push-Pull Output
8/13/2019 Lecture 4-IO Port Programming
7/19
Open Source
8/13/2019 Lecture 4-IO Port Programming
8/19
Open Drain
8/13/2019 Lecture 4-IO Port Programming
9/19
8/13/2019 Lecture 4-IO Port Programming
10/19
Port 0 (1)
Each pin of port 0 must be connectedexternally to a 10K ohm pull-up register.
8/13/2019 Lecture 4-IO Port Programming
11/19
8/13/2019 Lecture 4-IO Port Programming
12/19
Port 0 (3)
Example:
MOV A, #55H
Back: MOV P0, A
ACALL DELAY
CPL A
SJMP BACK
8/13/2019 Lecture 4-IO Port Programming
13/19
Port 0 (4)
Example:
MOV A, #0FFH
MOV P0, A
Back: MOV A, P0
MOV P1, A
SJMP BACK
8/13/2019 Lecture 4-IO Port Programming
14/19
Port 1 It can be used for input or output.
Port 1 is configured as an output port uponreset.
Port 1.x is configured as an input bit by
writing 1 to bit x of port 1. Port 1 isconfigured as an input port by writing 1 to
all the bits.
8/13/2019 Lecture 4-IO Port Programming
15/19
8/13/2019 Lecture 4-IO Port Programming
16/19
8/13/2019 Lecture 4-IO Port Programming
17/19
Port 3 It can be used for input or output.
Port 3 is configured as an output port upon reset.Port 3.x is configured as an input bit by
writing 1 to bit x of port 3. Port 3 is
configured as an input port by writing 1 to
all the bits. It provides alternate
functions.
8/13/2019 Lecture 4-IO Port Programming
18/19
Pins EA, PSEN, and ALE
EA (external access): EA is connected to VCC if code is stored in on-
chip ROM such as 8051 family.
EA is connected to Ground if code is stored inexternal ROM such as 8031.
PSEN (program store enable): PSEN is connected to OE of external ROM.
ALE (address latch enable):ALE is used to de-multiplexing the address and
data.
8/13/2019 Lecture 4-IO Port Programming
19/19
Single-Bit Address of Ports