0% found this document useful (0 votes)
6 views12 pages

EEE Project

The document outlines assembly language programs for performing 16-bit addition, subtraction, multiplication, and 8-bit division using a microcontroller (8051). It includes the necessary code, procedures, and memory addresses for storing results. Each section provides step-by-step instructions for executing the programs and verifying the outputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views12 pages

EEE Project

The document outlines assembly language programs for performing 16-bit addition, subtraction, multiplication, and 8-bit division using a microcontroller (8051). It includes the necessary code, procedures, and memory addresses for storing results. Each section provides step-by-step instructions for executing the programs and verifying the outputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

7

16 BIT ADDITION
Ex. No.: 1(b)
Date

Aim

To write and execute an ALP for addina


two numbers of 2 byte data of AODZ
and BC96H,, and store the
result from memory location 4201H.
Apparatus required

Microcontroller 8051 kit - 1


Program

MOV RO,#00H ; Initialize RO for carry


MOV DPTR,#4201H ; Load 4201H in DPTR
MOV A,#B2H ; Place the LSByte of first data in Acc
ADD A.#96H ; Add with the LSByte of second data
MOVX @DPTR,A ; Store the LSByte of result
INC DPTR ; Get the next address in DPTR
MOV A,#A8H ; Place MSByte of first data in Acc
ADDC A,#BCH ; Add with the MSByte of second data
MOVX @DPTR,A ; Store the MSByte of result
INC DPTR Get the next address

JNC NEXT ; If no carry, go to NEXT


INC RO ; Othervwise increment carry
MOV A,RO ; Move the carry to Acc
NEXT
MOVX @DPTR,A : Store the carry
HALT SJMP HALT
; Halt here
6

MULTIBYTE ADDITION

Memory address Op-code Instructions

MOV RO,#00H

MOV DPTR,#4201H

MOVA,#B2H

ADD A,#96H

MOVX @DPTR.A
INC DPTR
MOV A,#A8H

ADDC A,#BCH

MOVX @DPTR,A
INC DPTR
JNCNEXT

INC RO

NEXT MOV A,RO


MOVX @DPTR,A

HALT SJMP HALT


8
Proof :
Output Address Data
A 8 B 2 H +
4201 H (LSByte)
BC9 6 H
4202 H (MSByte)
4203 H (Carry)
Start
Flow Chart

Initialize RO for carry

Place the Lower byte of first


data in Acc

Add to the Lower byte of second data

Store the Lower byte of result

Place the Higher byte of first data


in Acc

Add to the Higher byte of second


data with carry

No
If C=1

Yes
Increment R0

Store the Higher byte of result

Store the Carry of result

Stop
9

Procedure

1. Switch ON the microcontroller (8051) kit.


2. Enter the op code of program one by one.
3. Execute the program.
4. Note its output.
5. Verify its output.
6. Switch OFF the microcontroller kit.
13

16-BIT SUBTRACTION
Ex. No.: 4
Date
: D4lot/24
Aim

A95BH from an another data


O Wite and execute an ALP for s btroctina the data
DoGoH, and store the result in memonv locations 4201H and 42021.
Apparatus required
Microcontroller 8051 kit -.1
Program
CLRC Clear carry bit
MOV DPT R,#4201H Load 4201H in DPTR
MOVA, #C3H Load lower byte of minuend in Acc
SUBB A, #5BH Subtract 5BH from C3H

MOVX @ DPTR, A Store Lower byte of result


INC DPTR Get the next address in DPTR

MOV A,#D6H Load higher byte of minuend in Acc.


SUBBA,#A9H ; Subtract A9H from D6H
MOVX @DPTR, A ; Store higher byte of result
HALT SJMP HALT ;Halt here

Procedure

1. Switch ON the.microcontroller (8051) kit.


2. Enter the op code of program one by one.

3. Execute the program.


4. Note its output.
5. Verity its output.
6. Switch OFF the misrocontroller kit.
Besult(
The ALPfor 16 bit subtraction is written and executed and its result is also verified.
16 BIT SUBTRACTION

Mnemonics
Memory address Op-code
CLRC
Ao0 C3 MOV DPTR,#4201H

Aln0 A2
AD 3 MOV A,#C3H
A10A A
A10 C
SUBB A, #5BH
94
MOVX @DPTR, A
INC DPTR
AB
MOV A,#D6H
14
pb SUBB A,#A9H
210c
MOVX@DPTR,A
AnE HALT 8JMP HALT
A10P 30

Data output table

Memory Address Data

4201 H (LSB)
4202 H 2D (MSB)
Proof
Irdr
1010 Io

D
2
here Halt ; HALT SJMP HALT
result MSByte
of the Sto.e @DPTR,A
; MOVX
Acc result
in MBByte
of the Place A,B MOV
address next the Create ; DPTR INC
result LSByte
of the Store @DPTR,A MOVX
address next the Create ; DPTR INC
data tWo Multiply
the ; AB
MUL
Acc in
data next the Get ; DPTR @
MOVX
A,
address next the Create ; DPTR INC
register Bin
data first the Place ; B,A MOV
Acc in
data first the Get DPTR A,@ MOVX
DPTR data
in first address
of the Load DPTR,#4201H
; MOV
Program
-1Microcontroller
kit8051
required Apparatus
4204H. and 4203H tions
loca
memory result
in the store and4202H, and4201H locations memory placed
in
hexadecimal
data numbers
of multiplving
two for ALP execute
an and write To
Aim
Date
No.2: Ex.
MULTIPLICATION BIT 8
11
14

8BIT MULTIPLICATION
Instructions
Memory address Op-code MOVDPTR,#4201H

A\02 MOVXA,@DPTR
Fo
MOV B,A

AlDS INC DPTR.


MOVXA, @DPTR
Aibt MUL AB
AA INC DPTR
MOVX @DPTR,A
INC DPTR

MOV A,B

MOVX @DPTR,A
AlbE
HALT SJMP HALT
ADE.30FE

Datainput table

|Address Data
4201 H b2
4202 H

Data output table


Address Data
4203 H

4204 H
register Acc result result
data the theregister
in
B data of
in two of Acc
in
placed byte
data second byte B Stop
Start the higher
in
first Multiplylower placed
the the
the the
Place Place Store
Store
Chart
Flow
Procedure
1. Switch ON the microcontroller (8051) kit.
2. Enter the op code of program one by one.
3. Enter the data input.
4. Execute the program.
5. Note its output.
6. Verify its output.
7. Switch OFF the microcontroller kit.
17

Ex. No.: 6
8BIT DIVISION
Date : l/ot/24
Aim:

l0 write and execute an ALP for


dividing the
4202FH by another number placed in memorv location number placed in memory locauon
locations 4203H and 4204 H. 4201H. and store the result in memory
Apparatus required
Microcontroller 8051 kit -1
Program

MOV DPTR, #4201H Load the address of denominator in DPTR


MOVÔA, @DPTR Get the denominator. in A register
MOV B,A Place the denominator in Bregister
INC DPTR ; Get the address of numerator in DPTR
MOVX A;@DPTR ;Get the numerator in A register
DIV AB :Divide thetwo numbers CAnSswert RemOm
INC DPTR :Get the next address for storing quotient
MOVX @DPTR,A Store the quotient
ING DPTR Get the next address in DPTR
MOV A,B Place the remainder in Aregister
MOVX @DPTR,A Store the remainder
HALT SJMP'HALT ; Halt here.

Procedure
1. Switch ON the microcontroller (8051) kit.
2. Enter the op code of program one by one.
3. Enter the data input.
4. Execute the program.
5. Note its output.
6 Verify its output.
7. Switch FF the microcòntroHer kit,
Resut
The ALP for 8-bit division is executed and its result is verified.
16

8BIT DIVISION
Memory-addrgss Op-code Instructions
MOV DPTR,#4201 H
y 9 o -

MOVX A,@DPTR
ALOA MOV B,A

INC DPTR
MOVX A;@DPTR
DV AB
AlD9Ag,
Ag ING DPTR

AlDA fo MOVX,@DPTR,A
AlDB Ag INCDPTR
MOV A,B
ADD
A10E MOVX @DPTR,A

80 HALT SJMP HALT

G
Data input table

|AddresS Data
|4201 H
(Denominator)
4202 H
(Numerator)
Data output table

|A\ddress Data
|4203 H' (Quotient)
4204 H (Re

You might also like