Professional Documents
Culture Documents
8051 Alp
8051 Alp
Embedded Systems
CHAPTER 6
ARITHMETIC, LOGIC
INSTRUCTIONS, AND
PROGRAMS
OBJECTIVES
A, source
;A = A + source
BCD
BCD
Figure 61
BCD Code
BCD
DA instruction
MOV A,#47H
MOV B,#25H
ADD A,B
DA A
10
SUBB
A, source
;A = A - source CY
In the 8051 we have only have subtract
with borrow SUBB.
There are two cases for the SUBB
instruction:
11
(1) with CY = 0
(2) with CY = l
12
13
14
15
16
Table 61
17
The
;divide A by B
19
;load 10 into B
;now A = 09 (quotient) and
;B = 05 (remainder)
Table 62
20
21
22
Positive numbers
The
23
Negative numbers
For
24
Compare instruction
CJNE
26
destination,source,relative address
instruction
Table 63
27
28
Serializing data
29
1. Using the serial port. The details of serial port data transfer
are discussed in Chapter 10.
2. The second method of serializing data is to transfer data
one bit at a time and control the sequence of data and spaces
in between them.
30
31
Table 64
ASCII numbers
32
Table 65
33
34
Next
Lecture
Proteus
35
Exercise 6