Archive for the ‘Lab Manuals’ Category

Program for Arithmatic operations in 89C51

AIM: To write programs for

i. Addition

ii. Subtraction

iii. Multiplication

iv. Division

of two numbers in 89C51.

    Addition

PROGRAM

MOV R0,#00

MOV DPTR,#4200

MOVX A,@DPTR

MOV B,A

INC DPTR

MOVX A,@DPTR

ADD A,B

JNC LABEL1

INC R0

LABEL1 : INC DPTR

MOVX @DPTR,A

MOV A,R0

INC DPTR

MOVX @DPTR,A

HERE : SJMP HERE

SAMPLE OUTPUT

ADDRESSES

DATA

INPUT/OUTPUT

4200

05

Input

4201

04

Input

4202

09

Output

4203

00

Output

    Subtraction

PROGRAM

MOV R0,#00

MOV DPTR,#4200

MOVX A,@DPTR

MOV B,A

INC DPTR

MOVX A,@DPTR

SUBB A,B

JNC LABEL1

INC R0

LABEL1 INC DPTR

MOVX @DPTR,A

MOV A,R0

INC DPTR

MOVX @DPTR,A

HERE SJMP HERE

SAMPLE OUTPUT

ADDRESSES

DATA

INPUT/OUTPUT

4200

01

Input

4201

05

Input

4202

04

Output

4203

00

Output

    Multiplication

PROGRAM

MOV R0,#00

MOV DPTR,#4200

MOVX A,@DPTR

MOV B,A

INC DPTR

MOVX A,@DPTR

MUL AB

INC DPTR

MOVX @DPTR,A

MOV A,B

INC DPTR

MOVX @DPTR,A

LABEL SJMP LABEL

SAMPLE OUTPUT

ADDRESSES

DATA

INPUT/OUTPUT

4200

01

Input

4201

0A

Input

4202

0A

Output

4203

00

Output

    Division

PROGRAM

MOV R0,#00

MOV DPTR,#4200

MOVX A,@DPTR

MOV B,A

INC DPTR

MOVX A,@DPTR,A

DIV AB

INC DPTR

MOVX @DPTR,A

MOV A,B

INC DPTR

MOVX @DPTR,A

LABEL SJMP LABEL

SAMPLE OUTPUT

ADDRESSES

DATA

INPUT/OUTPUT

4200

01

Input

4201

0A

Input

4202

0A

Output

4203

00

Output

RESULT:

Programs for

i. Addition

ii. Subtraction

iii. Multiplication

iv. Division

of two numbers were prepared and the output was obtained.

8085 program-Ascii to Decimal conversion

AIM

To prepare a program for 8085 to convert a decimal number to its corresponding ASCII number and to convert a given ASCII TO decimal.

PROGRAM FOR DECIMAL TO ASCII CONVERSION

LDA 4200

CPI 0A

JC LABEL1

ADI 30

JMP LABEL2

LABEL1:MVI A,EE

LABEL2:STA 4201

HLT

SAMPLE OUTPUT:

ADDRESS

DATA

INPUT/OUTPUT

4200

01

Input

4201

31

Output

PROGRAM FOR ASCII TO DECIMAL CONVERSION

LDA 4200

SUI 30

JC LABEL2

CPI 0A

JC LABEL1

LABEL2:MVI A,EE

LABEL1:STA 4201

HLT

SAMPLE OUTPUT

ADDRESS

DATA

INPUT/OUTPUT

4200

36

Input

4201

06

Output

RESULT

A program to convert decimal to ascii and ascii to decimal was prepared and output obtained.

Program to seperate bytes to nibbles in 8085

AIM:To prepare an assembly language program for 8085 to  separate  the nibbles of an 8 bit number.

PROGRAM:

MVI C,00

LDA 4200

MOV C,A

ANI OF

STA 4201

MOV A,C

ANI F0

RRC

RRC

RRC

RRC

STA 4202

HLT

SAMPLE OUTPUT

ADDRESS

DATA

INPUT/OUTPUT

4200

A3

INPUT

4201

03

OUTPUT

4202

0A

OUTPUT

RESULT:A program to separate the nibbles of a byte was prepared and output obtained.

Note: Complete list of 8085 Assembly Language programs are available in CircuitsToday. Find Link below:

8085 Microprocessor Programs-Lab Manual

Counting of number of zeros,even and odd numbers in an array

AIM :To prepare an assembly language program for 8085 to count the number of zeros,even and odd numbers in an array

PROGRAM

MVI C,00

MVI D,00

MVI E,00

LXI H,4200

MOV B,M

INX H

LXI H,4200

MOV B,M

LABEL4:INX H

MOV A,M

CPI 00

JNZ LABEL1

INR C

JNZ LABEL2

LABEL1:RRC

JNZ LABEL3

INR D

JMP LABEL2

LABEL3:INR E

LABEL2:DCR B

JNZ LABEL4

INX H

MOV A,C

MOV M,A

INX H

MOV A,D

MOV M,A

INX H

MOV A,E

MOV M,A

HLT

SAMPLE OUTPUT

ADDRESS

DATA

INPUT/OUTPUT

4200

09

Input

4201

00

Input

4202

06

Input

4203

02

Input

4204

11

Input

4205

0A

Input

4206

0D

Input

4207

00

Input

4208

0F

Input

4209

10

Input

420A

02

Output

420B

04

Output

420C

03

Output

RESULT:A program to find the number of even numbers ,odd numbers and zeros ,for 8085 was prepared and output obtained.

Square root of an 8 bit number in 8085

AIM

To prepare an assembly language program  to find the square root of an 8 bit number for 8085 microprocessor

PROGRAM

MVI C,01

MVI E,01

LDA 4200

LABEL:SUBB C

JZ LABEL1

INR C

INR C

INR E

JMP LABEL

LABEL1:MOV A,E

STA 4201

HLT

SAMPLE OUTPUT

ADDRESS

DATA

INPUT/OUTPUT

4200

10

Input

4201

04

Output

RESULT

A program to find the square root of a number was prepared and output obtained