mp&mc lab manual

94
Department of Electronics and Communications Engineering Experiment No: 1 ADDITION OF TWO 16-BIT NUMBERS AIM : To write an assembly language program to ADD two 16-BIT numbers using 8086 microprocessor Apparatus Required : 1. 8086 Micro processor kit. 2. Key Board. 3. Adapter. PROCEDURE: 1. Connect the power supply of +5v to the Kit. 2. Reset the Microprocessor Kit. 3. To Enter the program, the syntax is RESET A STARTING ADDRESS 4. Then Enter all the instructions of the program. 5. To give the input data, the syntax is RESET S STARTING ADDRESS Then enter the input data and use comma(,)to enter the next data. 6. To execute the program, syntax is RESET GO STARTING ADDRESS 7. To see the output which is present in output location the syntax is

Upload: ksudheer-kumar

Post on 29-Nov-2014

971 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 1

ADDITION OF TWO 16-BIT NUMBERS

AIM :To write an assembly language program to ADD two 16-BIT numbers

using 8086 microprocessor

Apparatus Required :

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Page 2: Mp&Mc Lab Manual

Bheema Institute of Science and Technology 1

Page 3: Mp&Mc Lab Manual
Page 4: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:MOV SI,@INPUT ADDRESS

MOV CL, 00H

MOV AL, [SI]

INC SI

MOV AH, [SI]

INC SI

MOV BL, [SI]

INC SI

MOV BH, [SI]

ADD AX, BX

JNC LABEL (OFFSET ADDRESS)

INC CL

LABEL: MOV SI,@OUTPUT ADDRESS

MOV [SI], AL

INC SI

MOV [SI], AH

INC SI

MOV [SI], CL

INT 03

RESULT: WITHOUT CARRY WITH CARRY

AH AL AH AL

BH BL BH BL------------------------------------------ ------------------------------------ AH AL CL=0 AH AL CL=1

Bheema Institute of Science and Technology 2

12 34

556

68

70

A4

AB

AB

CD

CD

57 9A

Page 5: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 2

SUBSTRACTION OF TWO 16-BIT NUMBERS

AIM :To write an assembly language program to SUBSTRACT two 16-BIT

numbers using 8086 microprocessor

Apparatus Required :

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Page 6: Mp&Mc Lab Manual

Bheema Institute of Science and Technology 1

Page 7: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:MOV SI,@INPUT ADDRESS

MOV CL, 00H

MOV AL, [SI]

INC SI

MOV AH, [SI]

INC SI

MOV BL, [SI]

INC SI

MOV BH, [SI]

SUB AX, BX

JNC LABEL (OFFSET ADDRESS)

INC CL

LABEL: MOV SI,@OUTPUT ADDRESS

MOV [SI], AL

INC SI

MOV [SI], AH

INC SI

MOV [SI], CL

INT 03

RESULT: WITHOUT BORROW WITH BORROW

AH AL AH AL

BH BL BH BL------------------------------------------ ------------------------------- AH AL CL=0 AH AL CL=1

Bheema Institute of Science and Technology

56 78

534

22

12

66

34

56

12

78

DD 9A

Page 8: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 3

MULTIPLICATION OF TWO 16-BIT NUMBERS

AIM :To write an assembly language program to MULTIPLY two 16-BIT numbers

using 8086 microprocessor

Apparatus Required :

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology 1

Page 9: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:MOV SI,@INPUT ADDRESS

MOV AL, [SI]

INC SI

MOV AH, [SI]

INC SI

MOV BL, [SI]

INC SI

MOV BH, [SI]

MUL BX

MOV SI,@OUTPUT ADDRESS

MOV [SI], AL

INC SI

MOV [SI], AH

INC SI

MOV [SI], DL

INC SI

MOV [SI], DH

INT 03

RESULT:

AH AL

BH BL ------------------------------------------------------------------------- DH DL AH AL

Bheema Institute of Science and Technology

12 34

54B

05

4C

5A A3 70

Page 10: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 4

DIVISION OF 32-BIT NUMBER BY 16-BIT NUMBER

AIM :To write an assembly language program to DIVIDE a 32-BIT number by

16-bit number using 8086 microprocessor

Apparatus Required :

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology 1

Page 11: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:MOV SI,@INPUT ADDRESS

MOV AL, [SI]

INC SI

MOV AH, [SI]

INC SI

MOV DL, [SI]

INC SI

MOV DH, [SI]

INC SI

MOV BL, [SI]

INC SI

MOV BH, [SI]

DIV BX

MOV SI,@OUTPUT ADDRESS

MOV [SI], AL

INC SI

MOV [SI], AH

INC SI

MOV [SI], DL

INC SI

MOV [SI], DH

INT 03

RESULT:

DH DL AH AL

BH BL ------------------------------------------------------------------------------

DH DL AH AL

02 014B

04

4C

F5 AA 9C

4C

4C

Page 12: Mp&Mc Lab Manual

Bheema Institute of Science and Technology

Department of Electronics and Communications Engineering

Experiment No: 5

SUM OF N NUMBERS

AIM :To write an assembly language program to perform the addition of N

numbers using 8086 microprocessor

Apparatus Required :

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Page 13: Mp&Mc Lab Manual

Bheema Institute of Science and Technology 1

Page 14: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:XOR AX, AX

XOR BX, BX

XOR CX, CX

XOR DX, DX

MOV SI,@INPUT ADDRESS

MOV CL, [SI]

BACK: INC SI

MOV AL, [SI]

ADD BX, AX

JNC LABEL (OFFSET ADDRESS)

INC DL

LABEL: LOOP BACK (OFFSET ADDRESS)

MOV SI,@OUTPUT ADDRESS

MOV [SI], BL

INC SI

MOV [SI], BH

INC SI

MOV [SI], DL

INT 03

RESULT: CL

AL

AL

AL

--------------------------------------------

BH BL DL

Bheema Institute of Science and Technology

03

AA

BB

CC

02 31 00

Page 15: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 6

SUM OF SQUARES OF N NUMBERS

AIM :To write an assembly language program to perform the addition of squares of N

numbers using 8086 microprocessor

Apparatus Required :

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology

Page 16: Mp&Mc Lab Manual

1

Page 17: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:XOR AX, AX

XOR BX, BX

XOR CX, CX

XOR DX, DX

MOV SI,@INPUT ADDRESS

MOV CL, [SI]

BACK: INC SI

MOV AL, [SI]

MUL AL

ADD BX, AX

JNC LABEL (OFFSET ADDRESS)

INC DL

LABEL: LOOP BACK (OFFSET ADDRESS)

MOV SI,@OUTPUT ADDRESS

MOV [SI], BL

INC SI

MOV [SI], BH

INC SI

MOV [SI], DL

INT 03

RESULT: CL

AL

AL

AL

--------------------------------------------

BH BL DL

Bheema Institute of Science and Technology

03

AA

BB

CC

9C 0D 01

Page 18: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 7

SUM OF CUBES OF N NUMBERS

AIM :To write an assembly language program to perform the addition of cubes of N

numbers using 8086 microprocessor

Apparatus Required :

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology

Page 19: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:XOR AX, AX

XOR BX, BX

XOR CX, CX

XOR DX, DX

MOV SI,@INPUT ADDRESS

MOV CL, [SI]

BACK: INC SI

MOV AL, [SI]

MOV AL, DL

MUL DL

MUL AL

ADD BX, AX

JNC LABEL (OFFSET ADDRESS)

INC DL

LABEL: LOOP BACK (OFFSET ADDRESS)

MOV SI,@OUTPUT ADDRESS

MOV [SI], BL

INC SI

MOV [SI], BH

INC SI

MOV [SI], DL

INT 03

RESULT: CL

AL

AL

AL

--------------------------------------------

BH BL DL

Bheema Institute of Science and Technology

03

0A

0B

0C

0F DB 00

Page 20: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No:8

ARITHMETIC MEAN OF N NUMBERS

AIM :To write an assembly language program to perform the arithmetic mean of N

numbers using 8086 microprocessor

Apparatus Required :

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology

Page 21: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:XOR AX, AX

XOR BX, BX

XOR CX, CX

XOR DX, DX

MOV SI,@INPUT ADDRESS

MOV CL, [SI]

MOV DL, CL

DEC CL

INC SI

MOV AL, [SI]

BACK: INC SI

MOV BL, [SI]

ADD AX, BX

JNC LABEL (OFFSET ADDRESS)

INC AH

LABEL: LOOP BACK (OFFSET ADDRESS)

DIV DL

MOV SI,@OUTPUT ADDRESS

MOV [SI], AL

INC SI

MOV [SI], AH

INT 03

RESULT: DL=CL AL AL

DL AL

-----------------------

AL AH AL-------------------------

AH AL

Bheema Institute of Science and Technology

03

01

02

03

0600

06

03

0200

Page 22: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 9

FINDING MINIMUM NUMBER AMONG 8-BIT DATA

AIM :To write an assembly language program to find a minimum number from given

8-bit N numbers using 8086 microprocessor

Apparatus Required :

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology

Page 23: Mp&Mc Lab Manual
Page 24: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:XOR AX, AX

XOR BX, BX

XOR CX, CX

MOV SI,@INPUT ADDRESS

MOV CL, [SI]

DEC CL

INC SI

MOV AL, [SI]

BACK: INC SI

MOV BL, [SI]

CMP AL, BL

JC LABEL (OFFSET ADDRESS)

MOV AL, BL

LABEL: LOOP BACK (OFFSET ADDRESS)

MOV SI,@OUTPUT ADDRESS

MOV [SI], AL

INT 03

RESULT:

CL:

DATA:

-----------------------------------------------------------------AL:

Bheema Institute of Science and Technology

05

06 02 01 09 08

01

Page 25: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 10

FINDING MAXIMUM NUMBER AMONG 8-BIT DATA

AIM:To write an assembly language program to find a maximum number from given

8-bit N numbers using 8086 microprocessor

Apparatus Required:

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology

Page 26: Mp&Mc Lab Manual
Page 27: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:XOR AX, AX

XOR BX, BX

XOR CX, CX

MOV SI,@INPUT ADDRESS

MOV CL, [SI]

DEC CL

INC SI

MOV AL, [SI]

BACK: INC SI

MOV BL, [SI]

CMP AL, BL

JNC LABEL (OFFSET ADDRESS)

MOV AL, BL

LABEL: LOOP BACK (OFFSET ADDRESS)

MOV SI,@OUTPUT ADDRESS

MOV [SI], AL

INT 03

RESULT:

CL:

DATA:

-----------------------------------------------------------------AL:

Bheema Institute of Science and Technology

05

06 02 01 09 08

09

Page 28: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 11

FINDING MINIMUM NUMBER AMONG 16-BIT DATA

AIM:To write an assembly language program to find a minimum number from given

16-bit N numbers using 8086 microprocessor

Apparatus Required:

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology

Page 29: Mp&Mc Lab Manual
Page 30: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:XOR AX, AX

XOR BX, BX

XOR CX, CX

MOV SI,@INPUT ADDRESS

MOV CL, [SI]

DEC CL

INC SI

MOV AL, [SI]

INC SI

MOV AH, [SI]

BACK: INC SI

MOV BL, [SI]

INC SI

MOV BH, [SI]

CMP AX, BX

JC LABEL (OFFSET ADDRESS)

MOV AX, BX

LABEL: LOOP BACK (OFFSET ADDRESS)

MOV SI,@OUTPUT ADDRESS

MOV [SI], AX

INT 03

RESULT: CL:

3 2 1

DATA:

-----------------------------------------------------------------------AH: AL:

Bheema Institute of Science and Technology

03

06 02 01 09 08

01

06

09

Page 31: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 12FINDING MAXIMUM NUMBER AMONG 16-BIT DATA

AIM:To write an assembly language program to find a maximum number from given

16-bit N numbers using 8086 microprocessor

Apparatus Required:

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology

Page 32: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:XOR AX, AX

XOR BX, BX

XOR CX, CX

MOV SI,@INPUT ADDRESS

MOV CL, [SI]

DEC CL

INC SI

MOV AL, [SI]

INC SI

MOV AH, [SI]

BACK: INC SI

MOV BL, [SI]

INC SI

MOV BH, [SI]

CMP AX, BX

JNC LABEL (OFFSET ADDRESS)

MOV AX, BX

LABEL: LOOP BACK (OFFSET ADDRESS)

MOV SI,@OUTPUT ADDRESS

MOV [SI], AX

INT 03

RESULT: CL:

3 2 1

DATA:

-----------------------------------------------------------------------AH: AL:

Bheema Institute of Science and Technology

03

06 02 01 09 08

08

06

06

Page 33: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 13

ARRANGING GIVEN 8-BIT DATA IN ASCENDING ORDER

AIM:To write an assembly language program to arrange given N numbers in ascending

order using 8086 microprocessor

Apparatus Required:

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology

Page 34: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:XOR AX, AX

XOR BX, BX

XOR CX, CX

MOV SI,@INPUT ADDRESS

MOV CL, [SI]

DEC CL

MOV DX, CX

AGAIN: INC SI

MOV AL, [SI]

BACK: INC SI

CMP AL, [SI]

JC LABEL (OFFSET ADDRESS)

XCHG AL, [SI]

LABEL: LOOP BACK (OFFSET ADDRESS)

SUB SI, DX

MOV [SI], AL

MOV CX, DX

LOOP AGAIN (OFFSET ADDRESS)

INT 03

RESULT: CL:

I/P DATA:

-----------------------------------------------------------------------O/P DATA:

Bheema Institute of Science and Technology

05

0E 0B 0C 0A 0D

0A 0E0D0B 0C

Page 35: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 14

ARRANGING GIVEN 16-BIT DATA IN DESCENDING ORDER

AIM:To write an assembly language program to arrange given N numbers in ascending

order using 8086 microprocessor

Apparatus Required:

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology

Page 36: Mp&Mc Lab Manual
Page 37: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:XOR AX, AX

XOR BX, BX

XOR CX, CX

MOV SI,@INPUT ADDRESS

MOV CL, [SI]

DEC CL

MOV DX, CX

AGAIN: INC SI

MOV AL, [SI]

BACK: INC SI

CMP AL, [SI]

JNC LABEL (OFFSET ADDRESS)

XCHG AL, [SI]

LABEL: LOOP BACK (OFFSET ADDRESS)

SUB SI, DX

MOV [SI], AL

MOV CX, DX

LOOP AGAIN (OFFSET ADDRESS)

INT 03

RESULT: CL:

I/P DATA:

-----------------------------------------------------------------------O/P DATA:

Bheema Institute of Science and Technology

05

0E 0B 0C 0A 0D

0E 0A0B0D 0C

Page 38: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 15

CONVERSION OF CELSIUS TEMPARATURE INTO FAHRENHEIT TEMPARATURE

AIM:To write an assembly language program to convert Celsius temperature into Fahrenheit

temperature using 8086 microprocessor

Apparatus Required:

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology

Page 39: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:XOR AX, AX

XOR BX, BX

MOV SI,@INPUT ADDRESS

MOV AL, [SI]

MOV BL, 09

MUL BL

MOV BL, 05

DIV BL

MOV BL, 20

ADD AX, BX

MOV SI,@OUTPUT ADDRESS

MOV [SI], AX

INT 03

RESULT:

F= (9/5) C+32

AL HEXA=19=>DECI=25

F=(9/5)25+32

F=77 HEXA=77=>DECI=4D

---------------------------------------------------------------AH AL

Bheema Institute of Science and Technology

19

00 4D

Page 40: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 16

CONVERSION OF FAHRENHEIT TEMPARATURE INTO CELSIUS TEMPARATURE

AIM:To write an assembly language program to convert Fahrenheit temperature into Celsius

temperature using 8086 microprocessor

Apparatus Required:

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology

Page 41: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:XOR AX, AX

XOR BX, BX

MOV SI,@INPUT ADDRESS

MOV AL, [SI]

MOV BL, 20

SUB AL, BL

MOV BL, 05

MOV BL

MOV BL, 09

DIV BL

MOV SI,@OUTPUT ADDRESS

MOV [SI], AX

INT 03

RESULT:

C= (F-32) *(5/9)

AL HEXA=4D=>DECI=77

C= (77-32)*(5/9)

C=19 HEXA=19=>DECI=25

---------------------------------------------------------------AH AL

Bheema Institute of Science and Technology

4D

00 19

Page 42: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 17

CONVERSION OF PACKED BCD INTO UNPACKED BCD NUMBER

AIM:To write an assembly language program to convert a packed BCD number into unpacked

BCD number using 8086 microprocessor

Apparatus Required:

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology

Page 43: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:XOR AX, AX

XOR BX, BX

MOV SI,@INPUT ADDRESS

MOV AL, [SI]

AND AL, 0F

MOV BL, [SI]

MOV CL, 04

ROR BL, CL

AND BL, 0F

MOV SI,@OUTPUT ADDRESS

MOV [SI], AL

INC SI

MOV [SI], BL

INT 03

RESULT: CL AL PACKED BCD

BL

ROR BL,CL

BL AL

AND

---------------------------------------------------------------BL AL

UNPACKED BCD

Bheema Institute of Science and Technology

19

09 01

91

0F 0F

04 91

91

Page 44: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 18

CONVERSION OF UNPACKED BCD INTO PACKED BCD NUMBER

AIM:To write an assembly language program to convert an unpacked BCD number into packed

BCD number using 8086 microprocessor

Apparatus Required:

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology

Page 45: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:XOR AX, AX

XOR BX, BX

MOV SI,@INPUT ADDRESS

MOV AL, [SI]

INC SI

MOV BL, [SI]

MOV CL, 04

ROR BL, CL

OR AL, BL

MOV SI,@OUTPUT ADDRESS

MOV [SI], AL

INT 03

RESULT: CL

BL AL UNPACKED BCD

ROR BL, CL

BL

AL

BL

--------------------------------------------------------------- AL

PACKED BCD

Bheema Institute of Science and Technology

Department of Electronics and Communications Engineering

02

24

04

20

04

20

04

Page 46: Mp&Mc Lab Manual

Experiment No: 19

CONVERSION OF DECIMAL INTO HEXADECIMAL NUMBER

AIM:To write an assembly language program to convert a DECIMAL number into

HEXADECIMAL number using 8086 microprocessor

Apparatus Required:

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology

Page 47: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:XOR AX, AX

XOR BX, BX

MOV SI,@INPUT ADDRESS

MOV AL, [SI]

MOV BL, AL

AND AL, 0F

MOV BH, AL

MOV CL, 04

ROR BL, CL

AND BL, 0F

MOV AL, 0A

MUL BL

ADD AL,BH

MOV SI,@OUTPUT ADDRESS

MOV [SI], AL

INT 03

RESULT: CL AL DECIMAL

BH BL

AL

BH

--------------------------------------------------------------- AL

HEXADEIMAL

Bheema Institute of Science and Technology

19

13

09

01

04

01

12

Page 48: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 20

CONVERSION OF HEXADECIMAL INTO DECIMAL NUMBER

AIM:To write an assembly language program to convert a HEXADECIMAL number into

DECIMAL number using 8086 microprocessor

Apparatus Required:

1. 8086 Micro processor kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology

Page 49: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:XOR AX, AX

XOR BX, BX

XOR CX, CX

XOR DX, DX

MOV SI,@INPUT ADDRESS

MOV AL, [SI]

MOV BL, 64

DIV BL

MOV DL, AL

MOV AL, AH

MOV AH, 00

MOV BL, 0A

DIV BL

MOV CL, AL

MOV BL, AH

MOV AX, 0100

MUL DX

INC SI

MOV [SI], AX

MOV AX, 0010

MUL CX

ADD AX, BX

ADD AX, [SI]

MOV SI,@OUTPUT ADDRESS

MOV [SI], AX

INT 03

RESULT: DL [SI] AX

AL CL BX

BL -------------------------------------------------- HEXADECIMAL

AX DECIMAL

Bheema Institute of Science and Technology

FF

0255

05 0050

02

05

0200

0005

Page 50: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 21

FINDING LARGEST NUMBER AMONG 8-BIT DATA USING 8051

AIM:To write an assembly language program to finding the largest number among given 8-BIT

N numbers using 8051 microcontroller.

Apparatus Required:

1. 8051 Micro Controller kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microcontroller Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

MD INPUT ADDRESS

Then enter the input data and use enter ( ) to enter the next data.

6. To execute the program, syntax is

RESET

G STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

MD STARTING ADDRESS

8. To view the program for modifications the syntax is

RESET

Z STARTING ADDRESS

Page 51: Mp&Mc Lab Manual

Bheema Institute of Science and Technology

Page 52: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:MOV DPTR, #STARTING ADDRESS

MOVX A, @DPTR

MOV R1, A

INC DPTR

MOVX A, @DPTR

DEC R1

L3: MOV B, A

INC DPTR

MOVX A, @DPTR

CJNE A, B, L1 (OFFSET ADDRESS)

L1: JNC L2 (OFFSET ADDRESS)

XCH A, B

L2: DJNZ R1, L3 (OFFSET ADDRESS)

MOV DPTR, #OUTPUT ADDRESS

MOVX @DPTR, A

L4: SJMP L4 (OFFSET ADDRESS)

RESULT:

R1:

DATA:

-----------------------------------------------------------------A:

Bheema Institute of Science and Technology

05

06 02 01 09 08

09

Page 53: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 22

FINDING SMALLEST NUMBER AMONG 8-BIT DATA USING 8051

AIM:To write an assembly language program to finding the SMALLEST number among given

8-BIT N numbers using 8051 microcontroller.

Apparatus Required:

1. 8051 Micro Controller kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microcontroller Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

MD INPUT ADDRESS

Then enter the input data and use enter ( ) to enter the next data.

6. To execute the program, syntax is

RESET

G STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

MD STARTING ADDRESS

8. To view the program for modifications the syntax is

RESET

Z STARTING ADDRESS

Bheema Institute of Science and Technology

Page 54: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:MOV DPTR, #STARTING ADDRESS

MOVX A, @DPTR

MOV R1, A

INC DPTR

MOVX A, @DPTR

DEC R1

L3: MOV B, A

INC DPTR

MOVX A, @DPTR

CJNE A, B, L1 (OFFSET ADDRESS)

L1: JC L2 (OFFSET ADDRESS)

XCH A, B

L2: DJNZ R1, L3 (OFFSET ADDRESS)

MOV DPTR, #OUTPUT ADDRESS

MOVX @DPTR, A

L4: SJMP L4 (OFFSET ADDRESS)

RESULT:

R1:

DATA:

-----------------------------------------------------------------A:

Bheema Institute of Science and Technology

05

06 02 01 09 08

01

Page 55: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 23

READING AND WRITING ON A PARALLEL PORT OF 8051

AIM:To write an assembly language program to perform the operations like reading and writing

the data on a parallel port of 8051 microcontroller.

Apparatus Required:

1. 8051 Micro Controller kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microcontroller Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

MD INPUT ADDRESS

Then enter the input data and use enter ( ) to enter the next data.

6. To execute the program, syntax is

RESET

G STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

MD STARTING ADDRESS

8. To view the program for modifications the syntax is

RESET

Z STARTING ADDRESS

Bheema Institute of Science and Technology

Page 56: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:

MOV DPTR, #STARTING ADDRESS

MOV A, 90

MOVX @DPTR, A

INC DPTR

MOVX A, @DPTR

MOV 90, A

INC DPTR

MOV A, 90

MOVX @DPTR, A

L4: SJMP L4 (OFFSET ADDRESS)

RESULT:

PORT IS ON

INPUT DATA: DATA IS READ OUTPUT

DATA IS WRITE

Bheema Institute of Science and Technology

00

85

FF

85

85

00

Page 57: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 24

BIT AND BYTE OPERATIONS BY USING 8051

AIM:To write an assembly language program to perform the BIT and BYTE operations like set,

reset and swap by using 8051 microcontroller.

Apparatus Required:

1. 8051 Micro Controller kit.2. Key Board.3. Adapter.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microcontroller Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

MD INPUT ADDRESS

Then enter the input data and use enter ( ) to enter the next data.

6. To execute the program, syntax is

RESET

G STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

MD STARTING ADDRESS

8. To view the program for modifications the syntax is

RESET

Z STARTING ADDRESS

Page 58: Mp&Mc Lab Manual

Bheema Institute of Science and Technology

Page 59: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM: BIT OPERATONS

SET A BIT:

MOV DPTR, #STARTING ADDRESS

MOVX A, @DPTR

SETB 0E5

INC DPTR

MOVX @DPTR, A

L4: SJMP L4 (OFFSET ADDRESS)

RESET A BIT:

MOV DPTR, #STARTING ADDRESS

MOVX A, @DPTR

CLR 0E5

INC DPTR

MOVX @DPTR, A

L4: SJMP L4 (OFFSET ADDRESS)

COMPLIMENT A BIT:

MOV DPTR, #STARTING ADDRESS

MOVX A, @DPTR

CPL 0E5

INC DPTR

MOVX @DPTR, A

L4: SJMP L4 (OFFSET ADDRESS)

RESULT:

SET A BIT

CLEAR A BIT

INPUT OUTPUT

COMPLIMENT A BIT

Bheema Institute of Science and Technology

C5

00

E5

C5

20

E5

20 00

Page 60: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM: BYTE OPERATONS

SWAP A BYTE:

MOV DPTR, #STARTING ADDRESS

MOVX A, @DPTR

SETB A

INC DPTR

MOVX @DPTR, A

L4: SJMP L4 (OFFSET ADDRESS)

COMPLIMENT A BYTE:

MOV DPTR, #STARTING ADDRESS

MOVX A, @DPTR

CPL A

INC DPTR

MOVX @DPTR, A

L4: SJMP L4 (OFFSET ADDRESS)

RESULT:

SWAP A BYTE

INPUT OUTPUT

COMPLIMENT A BYTE

Bheema Institute of Science and Technology

C5

00

5C

FF

FF 00

Page 61: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

Experiment No: 16

INTERFACING A STEPPER MOTOR WITH 8086 MICROPROPROCESSOR

AIM:To write an assembly language program to interface a stepper motor by using 8086

microprocessor to control the speed and rotating direction i.e. clockwise and anticlockwise of a stepper motor.

Apparatus Required:

1. 8086 Micro processor kit.2. Key Board.3. Adapter.4. Stepper motor.

PROCEDURE:

1. Connect the power supply of +5v to the Kit.

2. Reset the Microprocessor Kit.

3. To Enter the program, the syntax is

RESET

A STARTING ADDRESS

4. Then Enter all the instructions of the program.

5. To give the input data, the syntax is

RESET

S STARTING ADDRESS

Then enter the input data and use comma(,)to enter the next data.

6. To execute the program, syntax is

RESET

GO STARTING ADDRESS

7. To see the output which is present in output location the syntax is

RESET

S STARTING ADDRESS

Bheema Institute of Science and Technology

Page 62: Mp&Mc Lab Manual
Page 63: Mp&Mc Lab Manual

Department of Electronics and Communications Engineering

PROGRAM:MOV AX, 0000

MOV ES, AX

MOV DX, 0FFE6

MOV AL, 80

OUT DX, AL

CALLS 0FE00:01ED

JMP START

*/DISPLAY MESSAGE STRING*/

“0A 0D 45 4E 54 45 MES1: DB 0A, 0D,’ENTER DIRECTION’

52 20 44 49 52 45

43 54 49 4F 4E

0A 0D 41 2D 41 4E DB 0A, 0D,’A-ANTI CLOCKWISE

C-CLOCKWISE’, 00H

54 49 43 4C 4F 43

4B 57 49 53 45 20

20 20 20 20 43 2D

43 4C 4F 43 4B 57

49 53 45 00

2E 8D 16 12 20 START: LEA DX, MES1

MOV AX, DX

CALLS 0FE00:0013

GET: CALLS 0FE00:00A9

CMP AL, 41

JE ANTI

CMP AL, 43

JE CLO

JMP GET

Bheema Institute of Science and Technology

Page 64: Mp&Mc Lab Manual

*/ROUTINE FOR CLOCKWISE ROTATION OF MOTOR*/

CLO: CALL COMMON

R1: OUT DX, AL

CALL DELAY

RCR AL, 1

JMP R1

*/ROUTINE FOR CLOCKWISE ROTATION OF MOTOR*/

ANTI: CALL COMMON

R2: OUT DX, AL

CALL DELAY

RCL AL, 1

JMP R2

COMMON: CALLS 0FE00:0031

CALLS 0FE00:00

MOV AL, 11

MOV DX, 0FFE0

RET

*/ROUTINE TO CONTROL SPEED OF MOTOR*/

DELAY: MOV CX, @VALUE

SS: LOOP SS

RET

Bheema Institute of Science and Technology