Multiplication and Division of two 8-bit numbers - PowerPoint PPT Presentation

About This Presentation
Title:

Multiplication and Division of two 8-bit numbers

Description:

Microcontroller – PowerPoint PPT presentation

Number of Views:114
Slides: 19
Provided by: A.G.Balaji
Tags:

less

Transcript and Presenter's Notes

Title: Multiplication and Division of two 8-bit numbers


1
MULTIPLICATION AND DIVISION OF TWO 8-BIT NUMBERS
2
  • OBJECTIVES
  • To write and execute P89V51RD2 based assembly
    language program to Multiply two 8-bit numbers.
  • To write and execute P89V51RD2 based assembly
    language program to Divide two 8-bit numbers.
  • To execute and verify the result of above
    program.
  • RESOURCE REQUIRED
  • Microcontroller kit based on P89V51RD2
    1 No
  • Power supply for the kit
    1 No
  • PC
    . 1 No
  • Assembler keil µvision2 (to convert the ASM file
    to HEX) . 1 No

3
Microcontroller kit based on P89V51RD2
4
PIN DIAGRAM OF 8051
I/O PORTS OF 8051
8051
5
MULTIPLICATION OF TWO 8-BIT NUMBERS
ORG 00H MAIN MOV A,A1H
MOV B,A MOV P1,A CALL
DELAY MOV A,02H MOV P1,A
CALL DELAY MUL AB
MOV P1,A CALL DELAY MOV
A,B MOV P1,A CALL DELAY
SJMP MAIN DELAYMOV R7,0FFH AAA
MOV R6,0FFH BBB MOV R5,20H CCC
DJNZ R5,CCC DJNZ R6,BBB
DJNZ R7,AAA RET END
6
FLOW CHART
START
GET Ist DATA
A1 H
GET 2nd DATA
02 H
MUL 2 DATAS
STORE RESULTS
STOP
7
IN B REGISTER
PORT 1 P1
A1 H 1010 0001 0001 LOWER ORDER
BYTE 1010 HIGHER ORDER BYTE
8
IN A REGISTER
PORT 1 P1
02 H 0000 0010
0000 LOWER ORDER BYTE 0010 HIGHER ORDER BYTE
9
MUL AB
A1 H 1 0 1 0 0 0 0 1
PORT 1 P1
02 H 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0
0 1 0 1 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 1 0
PORT 1 P1
ANS 01 42 H
10
DATA 1 DATA 2 OUTPUT OUTPUT
HIGHER ORDER BYTE LOWER ORDER BYTE
HEXA A1 H 02 H 01 H 42 H
BINARY 1010 0001 0000 0010 0000 0001 0100 0010
11
DIVISION OF TWO 8-BIT NUMBERS
ORG 00H MAIN MOV A,50H
MOV B,A MOV P1,A CALL
DELAY MOV A,60H MOV P1,A
CALL DELAY DIV AB
MOV P1,A CALL DELAY MOV
A,B CALL DELAY MOV A,R1
MOV P1,A CALL DELAY
SJMP MAIN DELAYMOV R7,0FFH AAA MOV
R6,0FFH BBB MOV R5,20H CCC DJNZ
R5,CCC DJNZ R6,BBB DJNZ
R7,AAA RET END
12
FLOW CHART
START
GET Ist DATA
50 H
GET 2nd DATA
60 H
MUL 2 DATAS
STORE RESULTS
STOP
13
60 H 0 1 1 0 0 0 0 0
PORT 1 P1
0 1 1 0 LOWER ORDER BYTE 0 0 0 0 HIGHER ORDER
BYTE
14
PORT 1 P1
5 0 H 0 1 0 1 0 0 0 0
0 1 0 1 LOWER ORDER BYTE 0 0 0 0 HIGHER ORDER
BYTE
15
MODEL CALCULATION
0 1 0
0 2 0
0 4 0
0 8 0
0 16 0
1 32 32
1 64 64
0 128 0
96
0 1 0
0 2 0
0 4 0
0 8 0
1 16 16
0 32 0
1 64 64
0 128 0
80
60H
96 80
1.2

50H
16
QUOTIENT
QUOTIENT 01 H
PORT 1 P1
REMAINDER
REMAINDER 16 16
16 - 0
PORT 1 P1
1 REMAINDER 10 H
17
TABULATION
DATA 1 DATA 2 OUTPUT OUTPUT
REMAINDER QUOTIENT
HEXA 050 H 060 H 10H 01H
BINARY 0101 0000 0110 0000 0001 0000H 0000 0001
18
  • RESULT
  • Thus ASM program for 8 bit multiplication of two
    numbers is executed successfully.
  • ASM program for 8 bit division of two numbers is
    executed successfully.
  • The results are verified and recorded.
Write a Comment
User Comments (0)
About PowerShow.com