Ekt 225 Microcontroller I: 8051 Assembly Language Programming
Ekt 225 Microcontroller I: 8051 Assembly Language Programming
Ekt 225 Microcontroller I: 8051 Assembly Language Programming
CHAPTER 2
8051 ASSEMBLY
LANGUAGE
PROGRAMMING
1
OBJECTIVES
List the registers of the 8051 microcontroller
Manipulate data using the registers and MOV instructions
Code simple 8051 Assembly language instructions
Assemble and run an 8051 program
Describe the sequence of events that occur upon 8051 power-up
Examine programs in ROM code of the 8051
Explain the ROM memory map of the 8051
Detail the execution of 8051 Assembly language instructions
Describe 8051 data types
Explain the purpose of the PSW (program status word) register
Discuss RAM memory space allocation in the 8051
Diagram the use of the stack in the 8051
2
SECTION 2.1: INSIDE THE 8051
Registers
Figure 2–1a
Some 8-bit Registers of the 8051
3
SECTION 2.1: INSIDE THE 8051
Registers
4
SECTION 2.1: INSIDE THE 8051
5
SECTION 2.1: INSIDE THE 8051
MOV instruction
– MOV destination, source ;copy source to destination
6
SECTION 2.1: INSIDE THE 8051
ADD instruction
– ADD A, source ;ADD the source operand
;to the accumulator
7
SECTION 2.2: INTRODUCTION TO 8051
ASSEMBLY PROGRAMMING
8
SECTION 2.3: ASSEMBLING AND
RUNNING AN 8051 PROGRAM
9
SECTION 2.3: ASSEMBLING AND
RUNNING AN 8051 PROGRAM
11
SECTION 2.3: ASSEMBLING AND
RUNNING AN 8051 PROGRAM
Ist file
12
SECTION 2.4: THE PROGRAM COUNTER
AND ROM SPACE IN THE 8051
13
SECTION 2.4: THE PROGRAM COUNTER
AND ROM SPACE IN THE 8051
14
SECTION 2.4: THE PROGRAM COUNTER
AND ROM SPACE IN THE 8051
15
SECTION 2.4: THE PROGRAM COUNTER
AND ROM SPACE IN THE 8051
17
SECTION 2.5: 8051 DATA TYPES AND
DIRECTIVES
18
SECTION 2.6: 8051 FLAG BITS AND
THE PSW REGISTER
Figure 2–5
RAM Allocation in the 8051
21
SECTION 2.7: 8051 REGISTER BANKS
AND STACK
23
SECTION 2.7: 8051 REGISTER BANKS
AND STACK
24