Академический Документы
Профессиональный Документы
Культура Документы
muthmainnah
FACULTY OF MECHANICAL
ENGINEERING
CHAPTER 5: MICROPROCESSOR
SYSTEMS & APPLICATIONS
MEC523
APPLIED ELECTRONICS &
MICROPROCESSOR
Prepared by Nurul Muthmainnah Mohd
Noor
SLIDE 1
1
CHAPTER 5_PART 2
muthmainnah
Part 1
Part 2
SLIDE 2
2
CHAPTER 5_PART 2
muthmainnah
PART 2
5.3 I/O Port programming.
5.4 Addressing Mode.
SLIDE 3
3
CHAPTER 5_PART 2
muthmainnah
COURSE OUTCOME
SLIDE 4
4
CHAPTER 5_PART 2
muthmainnah
Objectives
◦ To differentiate between
microprocessor and microcontroller
◦ To know the family 8051
◦ To understand and assembly the
programming of 8051
SLIDE 5
5
CHAPTER 5_PART 2
muthmainnah
I/O PORT
PROGRAMMING
SLIDE 6
6
CHAPTER 5_PART 2
muthmainnah
I/O PROGRAMMING
SLIDE 7
7
CHAPTER 5_PART 2
muthmainnah
A (Accumulator)
All the
For ports uponand
all arithmetic RESET
logicare configured as input, ready to be used as
instructions
input ports
B, R0, R1, R2,- When theR5,
R3, R4, firstR6,
0 is written
R7 to a port, it becomes an output
SLIDE 8
8
CHAPTER 5_PART 2
muthmainnah
Port 0
It can be used for input or
output, each pin must be
connected externally to a 10K
ohm pull-up resistor
SLIDE 9
9
CHAPTER 5_PART 2
muthmainnah
Port 0
SLIDE 10
10
CHAPTER 5_PART 2
muthmainnah
Port 0 as Input
Value (proceeded with #) can be loaded directly to
registers A, B, or R0 – R7
SLIDE 11
11
CHAPTER 5_PART 2
muthmainnah
SLIDE 12
12
CHAPTER 5_PART 2
muthmainnah
Port 1
Port 1 can be used as input or output
◦ In contrast to port 0, this port
does not need any pull-up
resistors since it already has
pull-up resistors internally
◦ Upon reset, port 1 is
configured as an input port
SLIDE 13
13
CHAPTER 5_PART 2
muthmainnah
Port 1 as Input
SLIDE 14
14
CHAPTER 5_PART 2
muthmainnah
Port 2
Port 2 can be used as input or output
SLIDE 15
15
CHAPTER 5_PART 2
muthmainnah
SLIDE 16
16
CHAPTER 5_PART 2
muthmainnah
Port 3
Port 3 can be used as input or output
* Port 3 does not need any pull-up
resistors
* Port 3 is configured as an input port
upon reset, this is not the way it is
most commonly used
* Port 3 has the additional function of
providing some extremely important
signals
SLIDE 17
17
CHAPTER 5_PART 2
muthmainnah
Port 3
SLIDE 18
18
CHAPTER 5_PART 2
muthmainnah
SLIDE 19
19
CHAPTER 5_PART 2
muthmainnah
SLIDE 20
20
CHAPTER 5_PART 2
muthmainnah
SLIDE 21
21
CHAPTER 5_PART 2
muthmainnah
ADDRESSING
MODES
SLIDE 22
22
CHAPTER 5_PART 2
muthmainnah
SLIDE 23
23
CHAPTER 5_PART 2
muthmainnah
SLIDE 24
24
CHAPTER 5_PART 2
muthmainnah
ACCESSING MEMORY
Use registers to hold the data to
be manipulated
It is most often used the direct addressing mode to
access RAM locations 30 – 7FH
The entire 128 bytes of RAM can be accessed
The register bank locations are accessed by the
register names
SLIDE 25
25
CHAPTER 5_PART 2
muthmainnah
ACCESSING MEMORY
Contrast this with immediate addressing mode
SLIDE 26
26
CHAPTER 5_PART 2
muthmainnah
SLIDE 27
27
CHAPTER 5_PART 2
muthmainnah
SLIDE 28
28
CHAPTER 5_PART 2
muthmainnah
SLIDE 29
29
CHAPTER 5_PART 2
muthmainnah
When R0 and R1 hold the addresses of RAM locations, they must be preceded by the
“@” sign
SLIDE 30
30
CHAPTER 5_PART 2
muthmainnah
SLIDE 31
31
CHAPTER 5_PART 2
muthmainnah
SLIDE 32
32
CHAPTER 5_PART 2
muthmainnah
SLIDE 33
33
CHAPTER 5_PART 2
muthmainnah
SLIDE 34
34
CHAPTER 5_PART 2
muthmainnah
SLIDE 35
35
CHAPTER 5_PART 2
muthmainnah
END of PART 2
Let's do exercises
SLIDE 36
36