mpmc lab manual to print

201
1 8085 MICROPROCESSOR PROGRAMMING

Upload: kasthuri-selvam

Post on 07-Nov-2014

111 views

Category:

Documents


2 download

DESCRIPTION

usefull for lab working

TRANSCRIPT

Page 1: Mpmc Lab Manual to Print

1

8085 MICROPROCESSOR

PROGRAMMING

Page 2: Mpmc Lab Manual to Print

2

Ex. No: 01 8-BIT ADDITION AND SUBTRACTION

AIM:

To perform addition and subtraction of two 8-bit numbers using 8085

microprocessor.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit

• Power Chord

8 - B IT ADDI T I O N :

ALGORITHM:

Step1: Start the program.

Step2: Load the accumulator with the content of the memory location.

Step3: Move the content of accumulator to register B.

Step4: Load the accumulator with content of memory location.

Step5: Add the content of A with register B.

Step6: Store the content of accumulator in to memory location.

Step7: Stop the program.

MNEMONICS:

MVI C,00H

LXI H,4200H

MOV A,M

INX H

MOV B,M

ADD B

JNC XX

INR C

Page 3: Mpmc Lab Manual to Print

3

XX STA 4202H

MOV A,C

STA 4203H

HLT

TABLE 1:

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4100

4101

4102

4103

4104

4105

4106

4107

4108

4109

410A

410B

410C

410D

410E

410F

4110

XX

MVI

LXI

MOV

INX

MOV

ADD

JNC

INR

STA

MOV

C,00H

H,4200H

A,M

H

B,M

B

XX

C

4202H

A,C

0E

00

21

00

42

7E

23

46

80

D2

0D

41

0C

32

02

42

79

Move the value 00 to reg C

Load the value in HL pair.

Move the content of memory to

reg A

Increment the memory

location.

Move the content of memory to

reg B

Add content of B reg to

accumulator

If there is no carry jump to XX

Increment value to reg c Store

the content of accumulator in

memory 4202

Move the content of c reg to

accumulator

Page 4: Mpmc Lab Manual to Print

4

4111

4112

4113

4114

STA

HLT

4203H 32

03

42

76

Store the content of

accumulator in memory 4203

Halt the execution

OUTPUT (WITHOUT CARRY):

INPUT DATA: OUTPUT DATA:

4200: 06 4202: 08

4201: 02 4203: 00

OUTPUT (WITH CARRY):

INPUT DATA: OUTPUT DATA:

4200: FF 4202: FE

4201: FF 4203: 01

Page 5: Mpmc Lab Manual to Print

5

8 - B IT S U BT RAC T I O N :

ALGORITHM:

Step1: Load the accumulator with content of memory location

Step2: Move the content of accumulator to B reg

Step3: Load the accumulator with the content of memory location

Step4: Subtract the content of A with reg B

Step5: Store the content of accumulator into memory location

Step6: Stop the program

MNEMONICS:

MVI C,00

LXI H,4200H MOV

A,M INX H

MOV B,M SUB B

JNC XX INR C

CMA

INR A

XX: STA 4202H MOV

A,C STA 4203H

HLT

Page 6: Mpmc Lab Manual to Print

6

TABLE 2:

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4100

4101

4102

4103

4104

4105

4106

4107

4108

4109

410A

410B

410C

410D

410E

410F

4110

4111

4112

4113

4114

XX

MVI

LXI

MOV

INX

MOV

SUB

JNC

INR

CMA

INR

STA

MOV

STA

C,00

H,4200H

A,M

H

B,M

B

XX

C

A

4202H

A,C

4203H

0E

00

21

00

42

7E

23

46

90

D2

0F

41

0C

2F

3C

32

02

42

79

32

03

Move the value 00 to reg c

Load the value in HL reg pair

Move the content of memory to

accumulator

Increment the HL register pair

Move the content memory to reg

B

Sub reg B from accumulator

Jump to label XX if no carry

Increment the C reg

Take 1’s complement for

accumulator

Add 1’s complement with 1

Store the accumulator content in

4202H

Move the content of C reg to A

Store the accumulator content in

4203H

Page 7: Mpmc Lab Manual to Print

7

4115

4116 HLT

42

76 Halt the execution

OUTPUT (WITHOUT BORROW):

INPUT DATA: OUTPUT DATA:

4200:05 4202:02

4201:03 4203:00

OUTPUT (WITH BORROW):

INPUT DATA: OUTPUT DATA:

4200:14 4202:75

4201:89 4203:01

RESULT:

Thus the addition and subtraction of two 8-bit numbers using 8085

microprocessor was performed successfully

Page 8: Mpmc Lab Manual to Print

8

Ex. No: 02 16 BIT ADDITION AND SUBTRACTION

AIM:

To write an assembly language program to add and subtract two 16-bit

numbers using 8085 microprocessor kit.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit

• Power Chord

16 - B IT ADDI T I O N :

ALGORITHM:

Step1: Start the program.

Step2: Load 16 bit data in HL pair and move data 00H to ‘C’ register.

Step3: Exchange data from HL pair to DE pair.

Step4: Load another 16 bit data in HL pair.

Step5: Add HL pair and DE pair contents and store the result in HL pair.

Step6: If carry present Increment the content of CX register once else leave it as it is.

Step7: Store data in HL pair to specified memory.

Step8: Move data from ‘C’ register to accumulator.

Step9: Store the accumulator data in specified memory.

Step10: End.

Page 9: Mpmc Lab Manual to Print

MNEMONICS:

MVI C, 00H

LHLD 5300

XCHG

LHLD 5302

DAD D

JNC Loop1

INR C

Loop1: SHLD 5500

MOV A, C

STA 5502

HLT

TABLE: 1

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4100

4101

4102

4103

4014

4105

4106

4107

4108

4109

410A

410B

410C

MVI

LHLD

XCHG

LHLD

DAD

JNC

C, 00H

5300

5302

D

Loop1

0E

00

2A

00

53

EB

2A

02

53

19

D2

0E

41

Move 00H to C register

Load 16 bit data to HL pair

Exchange HL pair data with DE pair

Load another 16 bit data in HL pair

Add HL pair and DE pair contents

and store the result in HL pair

If no carry move to specified address

Page 10: Mpmc Lab Manual to Print

410D

410E

410F

4110

4111

4112

4113

4114

4115

Loop1:

INR

SHLD

MOV

STA

HLT

C

5500

A, C

5502

0C

22

00

55

79

32

02

55

76

Increment C register content once

Store data in HL pair to specified

memory

Move ‘C’ register data to accumulator

Store the accumulator data in

specified memory

Halt

OUTPUT:

INPUT DATA: OUTPUT DATA:

5300: 77 5500: 10

5301: 88 5501: 9A

5302: 99 5502: 00

5303: 11

Page 11: Mpmc Lab Manual to Print

16 - B IT S U BT RAC T I O N :

ALGORITHM:

Step1: Start the program.

Step2: Move immediately the data 00H to C register and accumulator.

Step3: Load 16 bit data in HL pair and exchange data from HL pair to DE pair.

Step4: Load another 16 bit data in HL pair.

Step5: Move data from ‘L’ register to accumulator.

Step6: Subtract ‘E’ register content from accumulator.

Step7: Move data from accumulator to ‘L’ register.

Step8: Move data from ‘H’ register to accumulator.

Step9: Subtract with borrow content of D register from accumulator.

Step10: Jump to Step 11 when no carry increment the content of C register once.

Step11: Move data from accumulator to ‘H’ register.

Step12: Store data in HL pair to specified memory.

Step13: Move data from ‘C’ register to accumulator.

Step14: Store the accumulator data in specified memory.

Step15: End.

MNEMONICS:

MVI C, 00H

MVI A, 00H

LHLD 5600

XCHG

LHLD 5602

MOV A, L

SUB E

MOV L, A

MOV A, H

SBB D

JNC Loop1

Page 12: Mpmc Lab Manual to Print

INR C

MOV H, A

Loop1: SHLD 5700

MOV A, C

STA 5702

HLT

TABLE: 2

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

41FE

41FF

4200

4201

4202

4203

4204

4205

4206

4207

4208

4209

420A

420B

420C

420D

420E

420F

MVI

MVI

LHLD

XCHG

LHLD

MOV

SUB

MOV

MOV

SBB

JNC

C, 00H

A, 00H

5600

5602

A, L

E

L, A

A, H

D

Loop1

0E

00

3E

00

2A

00

56

EB

2A

02

56

7D

93

6F

7C

9A

D2

12

Move 00H to C register

Move 00H to Accumulator

Load 16 bit data to HL pair

Exchange HL pair data with DE pair

Load another 16 bit data in HL pair

Move ‘L’ register data to accumulator

Subtract ‘E’ register content from

accumulator

Move accumulator data to ‘L’ register

Move ‘H’ register data to Acc.

Subtract with borrow content of D

register from accumulator

If no carry move to specified address

Page 13: Mpmc Lab Manual to Print

OUTPUT:

INPUT DATA: OUTPUT DATA:

5600: 11 5700: 66

5601: 21 5701: 78

5602: 77

5603: 99

RESULT:

Thus an assembly language program to add and subtract two 16-bit numbers

was written and executed using 8085 microprocessor kit.

Ex. No: 03

4210

4211

4212

4213

4214

4215

4216

4217

4218

4219

421A

Loop1:

INR

MOV

SHLD

MOV

STA

HLT

C

H, A

5700

A,C

5502

42

0C

67

22

00

57

79

32

02

57

76

Increment C register content once

Move Acc. data to ‘H’ register

Store data in HL pair to specified

memory

Move ‘C’ register data to accumulator

Store the accumulator data in

specified memory

Halt

Page 14: Mpmc Lab Manual to Print

8 BIT DATA MULTIPLICATION

AIM:

To multiply two 8 bit numbers stored at consecutive memory locations and store the result in memory.

ALGORITHM:

LOGIC: Multiplication can be done by repeated addition.1. Initialize memory pointer to data location.2. Move multiplicand to a register.3. Move the multiplier to another register.4. Clear the accumulator.5. Add multiplicand to accumulator6. Decrement multiplier7. Repeat step 5 till multiplier comes to zero.8. The result, which is in the accumulator, is stored in a memory location.

PROGRAM:

ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT

4100 LXI H, 4500 Initialize HL reg. to

4500

Transfer first data to reg. B

4101

4102

4103 MOV B, M

4104 INX H Increment HL reg. to point next mem. Location.

4105 MVI A, 00H Clear the acc.

4106

4107 MVI C, 00H Clear C reg for carry

4108

4109 LOOP1 ADD M Add multiplicand multiplier times.

410A JNC LOOP2 Jump to LOOP2 if there is no carry

410B

410C

Page 15: Mpmc Lab Manual to Print

410D INR C Increment C reg

410E LOOP2 DCR B Decrement B reg

410F JNZ LOOP1 Jump to LOOP1 if B is not zero.

4110

4111

4112 INX H Increment HL reg. to point next mem. Location.

4113 MOV M, A Transfer the result from acc. to memory.

4114 INX H Increment HL reg. to point next mem. Location.

4115 MOV M, C Transfer the result from C reg. to memory.

4116 HLT Stop the program

OBSERVATION:

S.NO INPUT OUTPUT

1. 4500 4502

4501 4503

RESULT: Thus the 8-bit multiplication was done in 8085p using repeated addition method

Page 16: Mpmc Lab Manual to Print

Ex. No: 04 16 BIT MULTIPLICATION

AIM:

To write an assembly language program to multiply two 16-bit data’s using

8085 microprocessor kit.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit

• Power Chord

ALGORITHM:

Step1: Start the program.

Step2: Load 16 bit data in HL pair and move data from HL pair to Stack Pointer.

Step3: Load another 16 bit data in HL pair and move the data to DE pair.

Step4: Move data 0000H to BC and HL pair.

Step5: Add 16 bit data present in Stack Pointer with HL pair.

Step6: If carry present goto Step 8 else goto step 7.

Step7: Increment BC register pair content once.

Step8: Decrement DE register pair content once.

Step9: Move D register content to accumulator and OR function it with E register

content.

Step10: Check whether A is zero or not. If A=0 goto Step 6 else goto Step 5.

Step11: Store HL pair content in memory.

Step12: Move BC pair content to HL pair and then to memory.

Step13: End.

Page 17: Mpmc Lab Manual to Print

MNEMONICS:

LHLD 4200

SPHL

LHLD 4202

XCHG

LXI H, 0000H

LXI B, 0000H

Loop1: DAD SP

JNC Loop2

INX B

Loop2: DCX D

MOV A, D

ORA E

JNZ Loop1

SHLD 4500

MOV H, B

MOV L, C

SHLD 4502

HLT

TABLE: 1

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4100

4101

4102

4103

4104

4105

4106

LHLD

SPHL

LHLD

4200

4202

2A

00

42

F9

2A

02

42

Load 16 bit data from memory to HL

pair

Move HL pair content to stack pointer

Load another 16 bit data from memory to

accumulator

Page 18: Mpmc Lab Manual to Print

4107

4108

4109

410A

410B

410C

410D

410E

410F

4110

4111

4112

4113

4114

4115

4116

4117

4118

4119

411A

411B

411C

411D

411E

411F

4120

4121

Loop1:

Loop2:

XCHG

LXI

LXI

DAD

JNC

INX

DCX

MOV

ORA

JNZ

SHLD

MOV

MOV

SHLD

HLT

H, 0000H

B, 0000H

SP

Loop2

B

D

A, D E

Loop1

4500

H, B

L, C

4502

EB

21

00

00

01

00

00

39

D2

13

41

03

1B

7A

B3

C2

0E

41

22

00

45

60

69

22

02

45

76

Move HL pair content to DE pair

Move data 0000H to HL pair

Move data 0000H to BC pair

Add SP data with HL pair data

If carry present jump to specified

memory

Increment BC pair content once

Decrement DE pair content once

Move D register content to Acc.

OR function Accumulator content

with E register content

Jump when no zero to specified

memory

Store HL pair content in specified

memory

Move B register content to H register

Move C register content to L register

Store HL pair content in specified

memory

Halt

Page 19: Mpmc Lab Manual to Print

OUTPUT:

INPUT DATA: OUTPUT DATA:

4200: 22 4500: C6

4201: 22 4501: 92

4202: 33 4502: D3

4203: 33 4503: 06

RESULT:

Thus an assembly language program to multiply two 16-bit data’s and was

written and executed using 8085 microprocessor kit.

Page 20: Mpmc Lab Manual to Print

Ex. No: 05 8- BIT DIVISION

AIM:

To write an assembly language program to divide two 8 bit data’s using 8085

microprocessor kit.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit

• Power Chord

ALGORITHM:

Step1: Start the program.

Step2: Move immediately the data 00H to B register and load 8 bit data from

memory to accumulator.

Step3: Move the accumulator content to C register.

Step4: Load another 8 bit data in HL pair.

Step5: Compare accumulator content with C register content. If equal Zero Flag gets

affected.

Step6: If A<C then carry gets affected.

Step7: Increment B register content once and subtract C register content from

accumulator.

Step8: Goto Step 5.

Step9: Store the accumulator data in specified memory.

Step10: Move data from ‘B’ register to accumulator.

Step11: Store the accumulator data in specified memory.

Step12: End.

Page 21: Mpmc Lab Manual to Print

MNEMONICS:

MVI B, 00H

LDA 5100

MOV C, A

LDA 5100

Loop1: CMP C

JC Loop2

INR B

SUB C

JMP Loop1

Loop2: STA 5300

MOV A, B

STA 5301

HLT

Page 22: Mpmc Lab Manual to Print

TABLE: 1

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4200

4201

4202

4203

4204

4205

4206

4207

4208

4209

420A

420B

420C

420D

420E

420F

4210

4211

4212

4213

4214

4215

4216

Loop2:

Loop1:

MVI

LDA

MOV

LDA

CMP

JC

INR

SUB

JMP

STA

MOV

STA

B, 00H

5100

C,A

5100

C

Loop2

B C

Loop1

5300

A, B

5301

06

00

3A

00

51

4F

3A

01

51

B9

DA

12

42

04

91

C3

09

42

32

00

53

78

32

Move immediately the data 00H to B

register

Load 8 bit data from memory to

accumulator

Move accumulator content to C

register

Load another 8 bit data in HL pair

from memory.

Compare accumulator content with C

register content

When carry set jump to specified

memory

Increment B register content once

Subtract C register content from

accumulator

Jump to specified memory

Store accumulator data in specified

Memory

Move data from ‘B’ register to

accumulator

Store accumulator data in specified

Page 23: Mpmc Lab Manual to Print

4217

4218

4219 HLT

01

53

76

memory

Halt

OUTPUT:

INPUT DATA: OUTPUT DATA:

5100: 20 5300: 00

5101: 60 5301: 03

RESULT:

Thus an assembly language program to divide two 8 bit data’s was written and

executed using 8085 microprocessor kit.

Page 24: Mpmc Lab Manual to Print

Ex. No: 0616 BIT DIVISION

AIM:

To perform Multiplication of two 16 bit numbers and store the result in a memory location using 8085 microprocessor kit

ALGORITHM:

1. Get the dividend and divisor.2. Initialize the register for quotient.3. Repeatedly subtract divisor from dividend till dividend becomes less than divisor.4. Count the number of subtraction which equals the quotient.5. Store the result in memory.

PROGRAM:

Memory Label MnemonicsOpcode Description

LHLD 4502Load the first No. in stack pointer through HL reg. pair

XCHG

LHLD 4500Load the second No. in HL reg. pair

& Exchange with DE reg. pair.

LXI B, 0000H

Clear BC reg. pair.

LOOP MOV A, LMove the content of reg. L to

Page 25: Mpmc Lab Manual to Print

Acc.

SUB ESubtract reg. E from that of Acc.

MOV L, AMove the content of Acc to L.

MOV A, HMove the content of reg. H Acc.

SBB D Subtract reg. D from that of Acc.

MOV H, A Move the content of Acc to H.

INX B Increment reg. Pair BC

JNC LOOP If there is no carry, go to the location labeled LOOP.

DCX B Decrement BC reg. pair.

DAD D Add content of HL and DE reg. pairs.

SHLD 4504 Store the content of HL pair in 4504 & 4505.

MOV A, C Move the content of reg. C to Acc.

STA 4506 Store the content of Acc. in memory 4506

MOV A, B Move the content of reg. B to Acc.

STA 4507 Store the content of Acc. in memory 4507.

Page 26: Mpmc Lab Manual to Print

HLT Stop the program execution.

OBSERVATION:

RESULT:

Thus the 16-bit division was done in 8085p using repeated subtraction method.

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

4500 4504

4501 4505

4502 4506

4503 4507

Page 27: Mpmc Lab Manual to Print

Ex. No: 07 SMALLEST AND LARGEST AMONG N NUMBERS

AIM:

To find the smallest and largest among N numbers using 8085

microprocessor.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit

• Power Chord

SMALLEST AMONG N NUMBERS:

ALGORITHM:

Step1: Start the program

Step2: Get the first number in the accumulator and move it to B

Step3: Get the second number in the memory and move it to the accumulator

Step4: Increment the address of memory and compare the data with accumulator

Step5: If there is carry the above process is continued until carry is not present

Step6: If carry is present then continue to compare with increment memory

Step7: If carry is absent move that data to accumulator and decrement the B register

until it become zero

Step8: Store the smallest number in the accumulator

Step9: End the program

Page 28: Mpmc Lab Manual to Print

MNEMONICS:

LDA 5000

MOV B,A

LXI H,5001

MOV A,M

XX: INX H

CMP M JC

XX MOV

A,M

XY: DCR B

JNZ XY

STA 6000

HLT

TABLE 1:

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4500

4501

4502

4503

4504

4505

4506

4507

4508

4509

450A

450B

XX

LDA

MOV

LXI

MOV

INX

CMP

JC

5000

B,A

H,5001

A,M

H

M

XX

3A

00

50

47

21

01

50

7E

23

BE

DA

0E

Move the first data to

accumulator

Move the data from A to B

Move the second data to memory

Move data from M toA

Increment the memory

Compare M with A

Jump if carry

23

Page 29: Mpmc Lab Manual to Print

450C

450D

450E

450F

4510

4511

4512

4513

4514

4515

XY

MOV

DCR

JNZ

STA

HLT

A,M

B

XY

6000

45

7E

05

C2

08

45

32

00

60

76

Move the data from M to A

Decrement B register

Jump if no zero

Store the data in accumulator

End of program

OUTPUT:

INPUT DATA: OUTPUT DATA:

5000: 15 6000:03

5001:03

5002:95

5003:28

Page 30: Mpmc Lab Manual to Print

L AR G ES T AM O NG N NUM BE R S :

ALGORITHM:

Step1: Start the program

Step2: Get the first number in the accumulator and move it to B

Step3: Get the second number in the memory H and move it to the accumulator

Step4: Increment the address of memory and compare the data with accumulator

Step5: If there is no carry the above process is continued until carry is present

Step6: If carry is present move that data to accumulator and decrement the B register

until

It becomes zero

Step7: Store the largest number in the accumulator

Step8: End the program

MNEMONICS:

LDA 5000

MOV B,A

LXI H,5001

MOV A,M

XX: INX H

CMP M

JNC XX

MOV A,M

XY: DCR B

JNZ XY

STA 6000

HLT

Page 31: Mpmc Lab Manual to Print

TABLE 2:

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4500

4501

4502

4503

4504

4505

4506

4507

4508

4509

450A

450B

450C

450D

450E

450F

4510

4511

4512

4513

4514

4515

XX

XY

LDA

MOV

LXI

MOV

INX

CMP

JNC

MOV

DCR

JNZ

STA

HLT

5000

B,A

H,5001

A,M

H

M

XX

A,M

B

XY

6000

3A

00

50

47

21

01

50

7E

23

BE

DA

0E

45

7E

05

C2

08

45

32

00

60

76

Move the first data to

accumulator

Move the data from A to B

Move the second data to memory

Move data from M toA

Increment the memory

Compare M with A

Jump no carry

Move the data from M to A

Decrement B register

Jump if no zero

Store the data in accumulator

End of program

Page 32: Mpmc Lab Manual to Print

OUTPUT:

INPUT DATA: OUTPUT DATA:

5000: 15 6000:95

5001:03

5002:95

5003:28

RESULT:

Thus the smallest and largest among n numbers was found using 8085

microprocessor and their output was verified

Page 33: Mpmc Lab Manual to Print

Ex. No: 08

ASCENDING AND DECENDING ORDER OF N

NUMBERS

AIM:

To determine the ascending and descending order of the given number using

8085 microprocessor.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit

• Power Chord

A S C E NDING O RD E R :

ALGORITHM:

Step1: Start the program

Step2: Get the first number and store it in B register and get the second number in

memory and move it to accumulator.

Step3: Increment memory and compare it with accumulator if carry is present

increment memory by decrementing B register if it is not zero.

Step4: If B register become zero decrement D register which contain number

first , zero is not obtained then get in the memory.

Step5: If it is zero store the result in the accumulator.

Step6: If the compared output contains no carry , move the value in memory to C

register and accumulator to memory and increment the value in memory.

Step7: stop the program.

Page 34: Mpmc Lab Manual to Print

MNEMONICS:

LDA 5000

MOV B,A

MOV D,A

MOV E,A

LXI H,5001

MOV A,M

MOV B,E

LOOP2 INX H

CMP M

JC LOOP1

MOV C,M

MOV M,A

DCX H

MOV M,C

INX H

LOOP1 MOV A,M

DCR B;

JNZ LOOP2

DCR B

JNZ LOOP3

HLT

Page 35: Mpmc Lab Manual to Print

TABLE: 1

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4500

4501

4502

4503

4504

4505

4506

4507

4508

4509

450A

450B

450C

450D

450E

450F

4510

4511

4512

4513

4514

4515

4516

4517

4518

4519

451A

LOOP 3

LOOP 2

LOOP 1

LDA

MOV

MOV

MOV

LXI

MOV

MOV

INX

CMP

JC

MOV

MOV

DCX

MOV

INX

MOV

DCR

JNZ

DCR

5000

B,A

D,A

E,A

H,5001

A,M

B,E

H

M

LOOP1

C,M

M,A

H

M,C

H

A,M

B

LOOP 2

D

3A

00

50

47

5F

57

21

01

50

7E

43

25

BE

DA

15

45

4E

`77

2B

71

23

7E

O5

C2

0B

45

15

Get the first data to accumulator

Move the data from A to B

Move the data from A to D

Move the data from A to E

Move second data to memory

Move M to Accumulator

Move E to B register

Increment H Register

Compare A and M

Jump if carry to loop1

Move M to C register

Move A to Memory

Decrement H Register

Move the value from C to H

Increment H Register

Move the value from M to A

Decrement B Register

Jump is no zero to LOOP 2

Decrement D Register

30

Page 36: Mpmc Lab Manual to Print

451B

451C

451D

451E

JNZ

HLT

LOOP 3 C2

06

45

76

Jump is no zero to LOOP 3

End of Program

OUTPUT:

INPUT DATA: OUTPUT DATA:

5000: 03 6000: 02

5001:05 6001: 03

5002:02 6002: 05

5003:06 6003: 06

Page 37: Mpmc Lab Manual to Print

D ES C E NDING O RD E R:

ALGORITHM:

Step1: Start the program

Step2: Get the first number and store it in B register and get the second number in

memory and move it to accumulator.

Step3: Increment memory and compare it with accumulator if carry is present

increment memory by decrementing B register if it is not zero.

Step4: If B register become zero decrement D register which contain number

first , zero is not obtained then get in the memory.

Step5: If it is zero store the result in the accumulator.

Step6: If the compared output contains no carry , move the value in memory to C

register and accumulator to memory and increment the value in memory.

Step7: stop the program.

MNEMONICS:

LDA 5000

MOV B,A

MOV D,A

MOV E,A

LXI H,5001

MOV A,M

MOV B,E

LOOP2 INX H

CMP M

JNC LOOP1

MOV C,M

MOV M,A

DCX H

MOV M,C

INX H

Page 38: Mpmc Lab Manual to Print

LOOP1 MOV A,M

DCR B;

JNZ LOOP2

DCR B

JNZ LOOP3

HLT

TABLE: 2

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4500

4501

4502

4503

4504

4505

4506

4507

4508

4509

450A

450B

450C

450D

450E

450F

4510

4511

4512

4513

LOOP 3

LOOP 2

LDA

MOV

MOV

MOV

LXI

MOV

MOV

INX

CMP

JNC

MOV

MOV

DCX

MOV

5000

B,A

D,A

E,A

H,5001

A,M

B,E

H

M

LOOP1

C,M

M,A

H

M,C

3A

00

50

47

5F

57

21

01

50

7E

43

25

BE

DA

15

45

4E

`77

2B

71

Get the first data to accumulator

Move the data from A to B

Move the data from A to D

Move the data from A to E

Move second data to memory

Move M to Accumulator

Move E to B register

Increment H Register

Compare A and M

Jump if carry to loop1

Move M to C register

Move A to Memory

Decrement H Register

Move the value from C to H

Page 39: Mpmc Lab Manual to Print

4514

4515

4516

4517

4518

4519

451A

451B

451C

451D

451E

LOOP1

INX

MOV

DCR

JNZ

DCR

JNZ

HLT

H

A,M

B

LOOP 2

D

LOOP 3

23

7E

O5

C2

0B

45

15

C2

06

45

76

Increment H Register

Move the value from M to A

Decrement B Register

Jump is no zero to LOOP 2

Decrement D Register

Jump is no zero to LOOP 3

End of Program

OUTPUT:

INPUT DATA: OUTPUT DATA:

5000: 03 6000: 06

5001:05 6001: 05

5002:02 6002: 03

5003:06 6003: 02

RESULT:

Thus the Ascending and Descending order of given N- numbers was

performed and their output was verified.

Page 40: Mpmc Lab Manual to Print

Ex. No: 09 CODE CONVERSIONS

AIM:

To write an assembly language program to convert hexadecimal to decimal

and hexadecimal to binary data’s using 8085-microprocessor kit.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit

• Power Chord

HE XAD E CIMAL T O D E CIMAL C O NV E R S I O N:

ALGORITHM:

Step1: Start the program.

Step2: Load data from memory to accumulator and move the data 00 to D and E

registers.

Step3: Compare the accumulator data with the data 64.

Step4: If carry=0 jump to Step 6 else jump to Step 5.

Step5: Jump to Step 10.

Step6: Subtract accumulator data by 64.

Step7: Increment the content of D register once.

Step8: If carry=0 jump to Step 6 else jump to Step 9.

Step9: Decrement the content of D register once and add data 64 with accumulator.

Step10: Subtract accumulator data by 0A and Increment E register content once.

Step11: If carry=0 jump to Step 10 and Decrement E register content once.

Step12: Add data 64 with accumulator and move it to C register.

Step13: Move E register content to accumulator.

Step14: Rotate the accumulator content 4 tines by left.

Step15: Add C register content with accumulator content.

Step16: Store data in accumulator pair to specified memory

Step17: Move D register content to accumulator

Page 41: Mpmc Lab Manual to Print

Step18: Store data in accumulator pair to specified memory.

Step19: End.

MNEMONICS:

MVI E, 00

MVI D, 00

LDA 4200

CPI 64

JNC Loop1

JMP Loop2

Loop1: SUI 64

INR D

JNC Loop1

DCR D

ADI 64

Loop2: SUI 0A

INR E

JNC Loop2

DCR E

ADI 0A

MOV C, A

MOV A, E

RLC

RLC

RLC

RLC

ADD C

STA 4500

MOV A, D

STA 4501

HLT

Page 42: Mpmc Lab Manual to Print

TABLE: 1

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4100

4101

4102

4103

4014

4105

4106

4107

4108

4109

410A

410B

410C

410D

410E

410F

4110

4111

4112

4113

4114

4115

4116

4117

4118

4119

411A

411B

411C

Loop1

Loop2

MVI

MVI

LDA

CPI

JNC

JMP

SUI

INR

JNC

DCR

ADI

SUI

INR

JNC

E, 00H

D, 00H

4200

64

410F

4118

64

D

410F

D

64

0A

E

4118

1E

00

16

00

3A

00

42

FE

64

D2

0F

41

C3

18

41

D6

64

14

D2

0F

41

15

C6

64

D6

0A

1C

D2

18

Move data 00 to E register

Move data 00 to D register

Load data from memory to

accumulator

Compare the accumulator data with

the data 64

If carry=0 jump to specified memory

Jump to specified memory

Subtract accumulator data by 64

Increment D register content once

If carry=0 jump to specified memory

Decrement D register content once

Add data 64 with accumulator

Subtract accumulator data by 0A

Increment E register content once

If carry=0 jump to specified memory

37

Page 43: Mpmc Lab Manual to Print

411D

411E

411F

4120

4121

4122

4123

4124

4125

4126

4127

4128

4129

412A

412B

412C

412D

412E

412F

DCR

ADI

MOV

MOV

RLC

RLC

RLC

RLC

ADD

STA

MOV

STA

HLT

E

0A

C, A

A, E

C

4500

A, D

4501

41

1D

C6

0A

4F

7B

07

07

07

07

81

32

00

45

7A

32

01

45

76

Decrement E register content once

Add data 64 with accumulator

Move accumulator content to C register

Move E register content to accumulator

Rotate the accumulator content 4 tines

by left

Add C register content with accumulator

content

Store data in accumulator pair to

specified memory

Move D register content to accumulator

Store data in accumulator pair to

specified memory

Halt

OUTPUT:

INPUT DATA: OUTPUT DATA:

4200: CE 4500: 06

4501: 02

Page 44: Mpmc Lab Manual to Print

HE XAD E CIMAL T O B INARY C O NV E R S I O N:

ALGORITHM:

Step1: Start the program.

Step2: Load data from memory to accumulator

Step3: Divide accumulator content by 2 and store the quotient in accumulator and

reminder in next consecutive memory location.

Step4: Repeat Step 3 until quotient becomes 1.

Step5: If quotient becomes 1 store it in next memory location.

Step6: End.

MNEMONICS:

LXI H, 4300

MOV A, M

MVI C, 02

Loop4: MVI D, 00

Loop1: SUB C

INR D

JC Loop2

JMP Loop1

Loop2: ADD C

INX H

MOV M, A

DCR D

MOV A, D

CPI 01

JZ Loop3

JMP Loop4

Loop3: INX H

MOV M, D

HLT

Page 45: Mpmc Lab Manual to Print

TABLE: 2

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4100

4101

4102

4103

4014

4105

4106

4107

4108

4109

410A

410B

410C

410D

410E

410F

4110

4111

4112

4113

4114

4115

4116

4117

4118

Loop4:

Loop1:

Loop2:

LXI

MOV

MVI

MVI

SUB

INR

JC

JMP

ADD

INX

MOV

DCR

MOV

CPI

JZ

H,4300

A,M

C,02

D, 00

C D

Loop2

Loop1

C

H

M, A

D

A, D

01

Loop3

21

00

43

72

0E

02

16

00

91

14

DA

10

44

C3

08

41

81

23

77

15

7A

FE

01

C4

1C

Load memory to HL register pair

Move data from memory to

accumulator

Move data 02 to C register

Initialize D register

Subtract C register content from A

Increment D register content once

Jump when carry=1 to specified

Memory

Jump to specified Memory

Add C register content with A

Increment HL pair content once

Move data from accumulator to

memory

Decrement D register content once

Move D register content to A

Compare D register content with 01

Jump when ZF=1 to specified

Memory

Page 46: Mpmc Lab Manual to Print

4119

411A

411B

411C

411D

411E

411F

Loop3:

JMP

INX

MOV

HLT

Loop4

H

M, D

41

C3

06

44

23

72

76

Jump to specified Memory

Increment HL pair memory once

Move D register data to Memory

Halt

OUTPUT:

INPUT DATA: OUTPUT DATA:

4300: DE 4301: 00 4305: 01

4302: 01 4306: 00

4303: 01 4307: 01

4304: 01 4308: 01

RESULT:

Thus an assembly language program to convert hexadecimal to decimal and

hexadecimal to binary data’s was written and executed using 8085-microprocessor

kit.

Page 47: Mpmc Lab Manual to Print

Ex. No: 10 FIBONACCI SERIES

AIM:

To write an assembly language program to generate Fibonacci series of ‘N’

number of data’s using 8085 microprocessor kit.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit

• Power Chord

ALGORITHM:

Step1: Start the program.

Step2: Move data 0A to ‘B’ register.

Step3: Clear the accumulator content and load data of 4200 to HL pair.

Step4: Move the data from accumulator to specified memory.

Step5: Decrement ‘B’ content once and Increment accumulator content once.

Step6: Increment ‘HL’ pair content once.

Step7: Move the data from accumulator to specified memory and decrement ‘HL’

pair content once.

Step8: Move data in memory to ‘C’ register and add ‘C’ register content with Acc.

Step9: Increment ‘HL’ pair content once and Decrement ‘B’ content once.

Step10: If no zero goto Step 11 else goto Step 6.

Step11: End.

Page 48: Mpmc Lab Manual to Print

MNEMONICS:

MVI B, 0A

XRA A

LXI H, 4200

MOV M, A

DCR B

INR A

Loop1: INX H

MOV M, A

DCX H

ADD M

INX H

DCR B

JNZ Loop1

HLT

Page 49: Mpmc Lab Manual to Print

TABLE: 1

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4100

4101

4102

4103

4014

4105

4106

4107

4108

4109

410A

410B

410C

410D

410E

410F

4110

4111

4112

Loop1

MVI

XRA

LXI

MOV

DCR

INR

INX

MOV

DCX

ADD

INX

DCR

JNZ

HLT

B, 0A

A

H, 4200

M, A

B

A

H

M, A

H

M

H

B

Loop1

06

0A

AF

21

00

42

77

05

23

77

2B

86

23

05

CZ

09

41

76

Move data 0A to ‘B’ register content

Clear the accumulator content

Load data of 4200 to HL pair

Move data from accumulator to M

Decrement ‘B’ content once

Increment accumulator content once

Increment H register content once

Move data from accumulator to M

Decrement ‘HL’ pair content once

Add data from M with accumulator

Increment ‘HL’ pair content once

Decrement ‘B’ content once

Jump to specified memory if no zero

Halt

Page 50: Mpmc Lab Manual to Print

OUTPUT:

INPUT DATA: OUTPUT DATA:

4101: 0A 4200: 00 4205: 05

4201: 01 4206: 08

4202: 01 4207: 13

4203: 02 4208: 1B

4204: 03 4209: 2E

RESULT:

Thus an assembly language program to generate Fibonacci series of ‘N’

number of data’s was written and executed using 8085 microprocessor kit.

45

Page 51: Mpmc Lab Manual to Print

Ex. No: 11 FACTORIAL OF ‘N’ DATA’S

AIM:

To write an assembly language program to calculate factorial of N number of

data’s using 8085 microprocessor kit.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit

• Power Chord

ALGORITHM:

Step1: Start the program.

Step2: Load 16 bit data in HL pair and move data from HL pair to DE pair.

Step3: Move E register content to B register.

Step4: Decrement B register content once and move B register content to C register.

Step5: Decrement B register pair content once and load 0000H HL pair.

Step6: Add DE pair content with HL pair content.

Step7: Decrement B register content once.

Step8: If there is no zero flag jump to Step 6.

Step9: Move HL pair content to DE pair and load 0000H HL pair.

Step10: Move C register content to B register.

Step11: Decrement C register content once.

Step12: If zero flag is set jump to Step 18.

Step13: Jump to Step 9.

Step14: Move HL pair content to DE pair.

Step15: Store HL pair content in specified memory.

Step16: End.

Page 52: Mpmc Lab Manual to Print

MNEMONICS:

LHLD 4200

XCHG

MOV B, E

DCR B

MOV C, B

DCR C

LXI H, 0000H

Loop1: DAD D

DCR B

JNZ Loop1

XCHG

LXI H, 0000H

MOV B, C

DCR C

JZ Loop2

JMP Loop1

Loop2: XCHG

SHLD 4300

HLT

Page 53: Mpmc Lab Manual to Print

TABLE: 1

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4100

4101

4102

4103

4014

4105

4106

4107

4108

4109

410A

410B

410C

410D

410E

410F

4110

4111

4112

4113

4114

4115

4116

4117

4118

4119

Loop1

LHLD

XCHG

MOV

DCR

MOV

DCR

LXI

DAD

DCR

JNZ

XCHG

LXI

MOV

DCR

JZ

JMP

4200

B, E

B

C, B

C

H, 0000H

D

B

410B

H, 0000H

B, C

C

411C

410B

2A

00

42

EB

42

05

48

0D

21

00

00

19

05

C2

0B

41

4B

21

00

00

41

0D

CA

1C

41

C3

Load 16 bit data to HL pair

Exchange HL pair data with DE pair

Move ‘E’ register data to ‘B’ register

Decrement ‘B’ content once

Move ‘B’ register data to ‘C’ register

Decrement ‘C’ content once

Load data of 0000 to HL pair

Add HL pair and DE pair contents

and store the result in HL pair

Decrement ‘B’ content once

Jump when no zero to specified

address

Exchange HL pair data with DE pair

Load data of 0000 to HL pair

Move ‘C’ register data to ‘B’ register

Decrement ‘C’ content once

If zero flag set jump to specified

address

Jump to specified address

Page 54: Mpmc Lab Manual to Print

411A

411B

411C

411D

411E

411F

4120

Loop2 XCHG

SHLD

HLT

4300

0B

41

EB

22

00

43

76

Exchange HL pair data with DE pair

Store data in HL pair to specified

memory

Halt

OUTPUT:

INPUT DATA: OUTPUT DATA:

4200: 05 4300: 78

RESULT:

Thus an assembly language program to calculate factorial of N number of

data’s was written and executed using 8085 microprocessor kit.

Page 55: Mpmc Lab Manual to Print

Ex. No: 12 PALINDROME

AIM:

To write an assembly language program to check whether the given number is

palindrome or not (for 32-bit data) using 8085-microprocessor kit.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit

• Power Chord

ALGORITHM:

Step1: Start the program.

Step2: Load16 bit data in HL pair and exchange data from HL pair to DE pair.

Step3: Load another 16 bit data in HL pair.

Step4: Move the data from H register to accumulator.

Step5: Rotate the accumulator content 4 times by left.

Step6: Perform XOR operation with accumulator and E register content.

Step7: Move accumulator data to ‘B’ register.

Step8: Move ‘D’ register content to accumulator.

Step9: Rotate the accumulator content 4 times by left.

Step10: Perform XOR operation with accumulator and L register content.

Step11: Perform OR operation with accumulator and B register content.

Step12: If zero flag set jump to specified address.

Step13: Store data in accumulator pair to specified memory.

Step14: End.

Page 56: Mpmc Lab Manual to Print

MNEMONICS:

LHLD 4200

XCHG

LHLD 4202

MOV A, H

RLC

RLC

RLC

RLC

XRA E

MOV B, A

MOV A, D

RLC

RLC

RLC

RLC

XRA L

ORA B

JZ Loop1

Loop1: STA 4300

HLT

51

Page 57: Mpmc Lab Manual to Print

TABLE: 1

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4100

4101

4102

4103

4014

4105

4106

4107

4108

4109

410A

410B

410C

410D

410E

410F

4110

4111

4112

4113

4114

LHLD

XCHG

LHLD

MOV

RLC

RLC

RLC

RLC

XAR

MOV

MOV

RLC

RLC

RLC

RLC

XAR

OAR

4200

4202

A, H

E

B, A

A, D

L

B

2A

00

42

EB

2A

02

42

7C

07

07

07

07

AB

47

7A

07

07

07

07

AD

B0

Load data to HL pair from memory

Exchange HL pair data with DE pair

Load another data to HL pair from

memory

Move data from H register to

accumulator

Rotate the accumulator content 4

times by left

Perform XOR operation with

accumulator and E register content

Move data from accumulator to B

register

Move data from D register to

accumulator

Rotate the accumulator content 4

tines by left

Perform XOR operation with

accumulator and L register content

Perform OR operation with

accumulator and B register content

52

Page 58: Mpmc Lab Manual to Print

4115

4116

4117

4118

4119

411A

411B

411C Loop2

JZ

MVI

STA

HLT

A, 01

4300

CA

19

41

3E

32

00

43

76

If zero flag set jump to specified

address

Move data 01 to accumulator

Store data in accumulator pair to

specified memory

Halt

OUTPUT:

INPUT DATA: OUTPUT DATA:

4200: 45 4300: 00

4201: 54

4202: 45

4203: 54

RESULT:

Thus an assembly language program to check whether the given number is

palindrome or not (for 32-bit data) was written and executed using 8085

microprocessor kit.

Page 59: Mpmc Lab Manual to Print

Ex. No: 13 SUM OF SERIES

AIM:

To write an assembly language program to calculate sum of series of ‘N’

number of data’s with carry using 8085 microprocessor kit.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit

• Power Chord

ALGORITHM:

Step1: Start the program.

Step2: Move the memory address to ‘H’ register.

Step3: Move the data present in memory to ‘E’ register.

Step4: Initialize the ‘C’ register as 00H.

Step5: Clear the accumulator content and increment ‘H’ register pair.

Step6: Move the data from memory to accumulator.

Step7: Increment ‘H’ content once and add it with accumulator.

Step8: Decrement ‘E’ content once. Check whether carry is present or not.

Step9: If no carry, increment ‘H’ content once and add it with accumulator.

Step10: If carry present Increment the content of CX register once and repeat Step 8.

Step11: Repeat the above steps for ‘N’ number of data’s.

Step12: Store the result in specified memory.

Step13: End.

Page 60: Mpmc Lab Manual to Print

MNEMONICS:

LXI H, 5300

MOV E, M

MVI C, 00H

XRA A

Loop1: INX H

ADD M

JNC Loop 2

INR C

Loop2: DCR E

JNZ Loop1

STA 4600

MOV A, C

STA 4601

HLT

55

Page 61: Mpmc Lab Manual to Print

TABLE:

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4100

4101

4102

4103

4014

4105

4106

4107

4108

4109

410A

410B

410C

410D

410E

410F

4110

4111

4112

4113

4114

4115

4116

4117

4118

Loop1

Loop2:

LXI

MOV

MVI

XRA

INX

ADD

JNC

INR

DCR

JNZ

STA

MOV

STA

HLT

H, 5300

E, M

C, 00H

A

H

M

Loop 2

C E

Loop1

4600

A, C

4601

21

00

53

5E

0E

00

AF

23

86

D2

0D

41

0C

1D

C2

07

41

32

00

46

79

32

01

46

76

Load 16 bit address in HL register

pair

Move data from memory to E register

Move data 00H to register ‘C’

OR function the accumulator content

Increment H register content once

Add data from M with accumulator

Jump on no carry

Increment C register content once

Decrement ‘E’ content once

Jump on no zero

Store data from accumulator to the

specified memory

Move data form C register to Acc.

Store data from accumulator to the

specified memory

Halt

Page 62: Mpmc Lab Manual to Print

OUTPUT:

INPUT DATA: OUTPUT DATA:

5300: 0A 5306: 06 4600: 70

5301: 11 5307: 17 4601: 00

5302: 12 5308: 09

5303: 13 5309: 0A

5304: 04 530A: 01

5305: 05

RESULT:

Thus an assembly language program to calculate sum of series of ‘N’ number

of data’s with carry was written and executed using 8085 microprocessor kit.

Page 63: Mpmc Lab Manual to Print

Ex No: 14 SQUARE ROOT

AIM:

To find the square root of a given 8 – bit number by using 8085

microprocessor.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit

• Power Chord

ALGORITHM:

Step1: Start the program.

Step2: Load the data to accumulator and move it to the B register.

Step3: Load another data in the accumulator.

Step4: Clear the accumulator.

Step5: Subtract the data and if there is no carry go to loop1

Step6: Increment C by 1 and increment B by 1 two times.

Step7: If there is carry go to loop2.

Step8: Move the data C - registers to accumulator.

Step9: Store the result.

Step10:Stop the program.

MNEMONICS:

LDA 5000

MOV B,A

LDA 5001

MVI C,00H

LOOP1 SUB B

JC LOOP2

INR C

INR B

INR B

Page 64: Mpmc Lab Manual to Print

JMP LOOP1

LOOP2 MOV A,C

STA 6000

HLT

TABLE:

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4100

4101

4102

4103

4014

4105

4106

4107

4108

4109

410A

410B

410C

410D

410E

410F

4110

4111

4112

4113

4114

4115

LOOP1

LOOP2

LDA

MOV

LDA

MVI

SUB

JC

INR

INR

INR

JMP

MOV

STA

5000

B,A

5001

C,00H

B

LOOP2

C

B

B

LOOP1

A,C

6000

3A

00

50

47

3A

01

50

0E

00

90

DA

13

41

0C

04

04

C3

09

41

79

32

00

Load the data in accumulator.

Move data to B register

Load the another data in accumulator

Clear the C-register.

Subtract the data

If carry=1 go to loop2

Increment C by 1

Increment B by 1

Increment B by 1

Jump to loop1

Move the data to A-reg

Store the result

59

Page 65: Mpmc Lab Manual to Print

4116

4117 HLT

60

76 Stop the program

OUTPUT:

OUTPUT DATA:

5000:01H

5001:10H

6000:04H

RESULT:

Thus the square root of the given 8- bit number was obtained by using 8085

microprocessor.

Page 66: Mpmc Lab Manual to Print

8086 MICROPROCESSOR

PROGRAMMING

Page 67: Mpmc Lab Manual to Print

Ex. No: 15 32 BIT ADDITION AND SUBTRACTON

AIM:

To write an assembly language program to add and subtract two 32-bit

numbers using 8086 microprocessor kit.

APPARATUS REQUIRED:

• 8086 Microprocessor Kit

• Power Chord

• Key Board

32 - B IT ADDI T I O N :

ALGORITHM:

Step1: Start the program.

Step2: Move immediately the number 0000H to CX register.

Step3: Copy the contents of the memory 3000 to AX register.

Step4: Add the content of the memory 3004 with the content of AX register.

Step5: Copy the content to AX register to two memories from 2000.

Step6: Copy the contents of the memory 3002 to AX register.

Step7: Add the content of the memory 3006 with the content of AX register.

Step8: Jump to specified memory location if there is no carry i.e. CF=0.

Step9: Increment the content of CX register once.

Step10: Copy the content to AX register to two memories from 2002.

Step11: Copy the content to CX register to two memories from 2004.

Step12: End.

Page 68: Mpmc Lab Manual to Print

MNEMONICS:MOV CX, 0000

MOV AX, [3000]

ADD AX, [3004]

MOV [2000], AX

MOV AX, [3002]

ADC AX, [3006]

JNC loop1

INC CX

Loop1 MOV [2002], AX

MOV [2004], CX

HLT

TABLE: 1

Memory LabelMnemonics

DescriptionInstruction Operand

1000

1004

1008

100C

1010

1014

1018

101A

101B Loop1

MOV

MOV

ADD

MOV

MOV

ADC

JNC

INC

MOV

CX,0000

AX, [3000]

AX, [3004]

[2000], AX

AX, [3002]

AX, [3006]

loop1

CX

[2002], AX

Move immediately 0000H to CX register

Copy contents of 3000 to AX register

Add content of memory 3004 with

content of AX register

Copy content to AX register to two

memories from 2000

Copy contents of memory 3002 to

AX register

Add content of memory 3006 with

content of AX register

Jump to specified memory CF=0

Increment content of CX register

once

Copy content to AX register to two

memories from 2002

Page 69: Mpmc Lab Manual to Print

101F

1023

MOV

HLT

[2004], CXCopy content to CX register to two

memories from 2004

Halt

OUTPUT:

INPUT DATA: OUTPUT DATA:

3000: 9999 2000: 3332

3002: 9999 2002: 3333

3004: 9999 2004: 1

3006: 9999

Page 70: Mpmc Lab Manual to Print

32 - B IT S U BT RAC T I O N :

ALGORITHM:

Step1: Start the program.

Step2: Move immediately the number 0000H to CX register.

Step3: Copy the contents of the memory 3000 to AX register.

Step4: Add the content of the memory 3004 with the content of AX register.

Step5: Copy the content to AX register to two memories from 2000.

Step6: Copy the contents of the memory 3002 to AX register. Step7:

Subtract the content of the memory 3006 from AX register. Step8:

Jump to specified memory location if there is no carry i.e. CF=0. Step9:

Increment the content of CX register once.

Step10: Copy the content to AX register to two memories from 2002.

Step11: Copy the content to CX register to two memories from 2004.

Step12: End.

MNEMONICS:

MOV CX, 0000

MOV AX, [3000]

ADD AX, [3004]

MOV [2000], AX

MOV AX, [3002]

SBB AX, [3006]

JNC loop1

INC CX

Loop1 MOV [2002], AX

MOV [2004], CX

HLT

Page 71: Mpmc Lab Manual to Print

TABLE: 2

Memory LabelMnemonics

DescriptionInstruction Operand

1000

1004

1008

100C

1010

1014

1018

101A

101B

101F

1023

Loop1

MOV

MOV

ADD

MOV

MOV

SBB

JNC

INC

MOV

MOV

HLT

CX,0000

AX, [3000]

AX, [3004]

[2000], AX

AX, [3002]

AX, [3006]

loop1

CX

[2002], AX

[2004], CX

Move immediately 0000H to CX register

Copy contents of 3000 to AX register

Add content of memory 3004 with

content of AX register

Copy content to AX register to two

memories from 2000

Copy contents of memory 3002 to

AX register

Subtract content of memory 3006

from content of AX register

Jump to specified memory CF=0

Increment content of CX register

once

Copy content to AX register to two

memories from 2002

Copy content to CX register to two

memories from 2004

Halt

OUTPUT:

INPUT DATA: OUTPUT DATA:

3000: 9999 2000: 0000

3002: 9799 2002: FE00

3004: 9999

3006: 9999

RESULT:

Thus an assembly language program to add and subtract two 32-bit numbers

was written and executed using 8086 microprocessor kit.

Page 72: Mpmc Lab Manual to Print

Ex. No: 16 16 BIT MULTIPLICATION AND DIVISION

AIM:

To write an assembly language program to multiply and divide two unsigned

16-bit numbers using 8086 microprocessor kit.

APPARATUS REQUIRED:

• 8086 Microprocessor Kit

• Power Chord

• Key Board

MU LT I P L ICA T I O N :

ALGORITHM:

Step 1: Start the program.

Step2: Copy the contents of the memory 3000 to AX register.

Step3: Copy the contents of the memory 3002 to CX register.

Step4: Multiply the content of the CX register with the content of accumulator.

Step5: Copy the content to AX register to the memory 2000.

Step6: Copy the contents of DX register to the memory 2002.

Step7: End.

MNEMONICS:

MOV AX, [3000]

MOV CX, [3002]

MUL CX

MOV [2000], AX

MOV [2002], DX

HLT

Page 73: Mpmc Lab Manual to Print

TABLE: 1

Memory LabelMnemonics

DescriptionInstruction Operand

1000

1004

1008

100A

100E

1012

MOV

MOV

MUL

MOV

MOV

HLT

AX, [3000]

CX, [3002]

CX

[2000], AX

[2004], DX

Copy contents of 3000 to AX register

Copy contents of 3002 to CX register

Multiply the content of the CX register

with the content of accumulator

Copy content to AX register to the

memory 2000

Copy content to DX register to the

memory 2002

Halt

OUTPUT:

INPUT DATA: OUTPUT DATA:

3000: 1234 2000: 0060

3002: 5678 2002: 0626

Page 74: Mpmc Lab Manual to Print

DIVI S I O N :

ALGORITHM:

Step 1: Start the program.

Step2: Copy the contents of the memory 3000 to AX register.

Step3: Copy the contents of the memory 3002 to CX register.

Step4: Divide the content of the CX register from the content of accumulator.

Step5: Copy the content to AX register to the memory 2000.

Step6: Copy the contents of DX register to the memory 2002.

Step7: End.

MNEMONICS:

MOV AX, [3000]

MOV CX, [3002]

DIV CX

MOV [2000], AX

MOV [2002], DX

HLT

TABLE: 2

Memory LabelMnemonics

DescriptionInstruction Operand

1000

1004

1008

100A

100E

1012

MOV

MOV

DIV

MOV

MOV

HLT

AX, [3000]

CX, [3002]

CX

[2000], AX

[2004], DX

Copy contents of 3000 to AX register

Copy contents of 3002 to CX register

Divide the content of the CX register

with the content of accumulator

Copy content to AX register to the

memory 2000

Copy content to DX register to the

memory 2002

Halt

Page 75: Mpmc Lab Manual to Print

OUTPUT:

INPUT DATA: OUTPUT DATA:

3000: 1234 2000: 0000

3002: 5678 2002: 4444

RESULT:

Thus an assembly language program to multiply and divide two unsigned

16-bit numbers was written and executed using 8086 microprocessor kit.

Page 76: Mpmc Lab Manual to Print

EXPT NO:17

LARGEST& SMALLEST

AIM:

To write an Assembly Language Program (ALP) to find the largest and smallest number in a given array.

APPARATUS REQUIRED:

• 8086 Microprocessor Kit

• Power Chord

• Key Board

PROBLEM STATEMENT:

An array of length 10 is given from the location. Find the largest and smallest number and store the result.

ALGORITHM:

(i) Finding largest number:

a. Load the array count in a register C1.b. Get the first two numbers.c. Compare the numbers and exchange if the number is small.d. Get the third number from the array and repeat the process until C1 is 0.

(ii) Finding smallest number:

a. Load the array count in a register C1.b. Get the first two numbers.c. Compare the numbers and exchange if the number is large.d. Get the third number from the array and repeat the process until C1 is 0.

Page 77: Mpmc Lab Manual to Print

LARGEST

RESULT:

INPUT

MEMORY

DATA

OUTPUT

MEMORY

DATA

PROGRAM COMMENTS

MOV SI,1200H Initialize array size

MOV CL,[SI] Initialize the count

INC SI Go to next memory location

MOV AL,[SI] Move the first data in AL

DEC CL Reduce the count

L2 : INC SI Move the SI pointer to next data

CMP AL,[SI] Compare two data’s

JNB L1 If AL > [SI] then go to L1 ( no swap)

MOV AL,[SI] Else move the large number to AL

L1 : DEC CL Decrement the count

JNZ L2 If count is not zero go to L2

MOV DI,1300H Initialize DI with 1300H

MOV [DI],AL Else store the biggest number in 1300 location

HLT Stop

Page 78: Mpmc Lab Manual to Print

SMALLEST

RESULT:

INPUT

MEMORY

DATA

OUTPUT

MEMORY

DATA

RESULT

Thus largest and smallest number is found in a given array.

PROGRAM COMMENTS

MOV SI,1200H Initialize array size

MOV CL,[SI] Initialize the count

INC SI Go to next memory location

MOV AL,[SI] Move the first data in AL

DEC CL Reduce the count

L2 : INC SI Move the SI pointer to next data

CMP AL,[SI] Compare two data’s

JB L1 If AL < [SI] then go to L1 ( no swap)

MOV AL,[SI] Else move the large number to AL

L1 : DEC CL Decrement the count

JNZ L2 If count is not zero go to L2

MOV DI,1300H Initialize DI with 1300H

MOV [DI],AL Else store the biggest number in 1300 location

HLT Stop

Page 79: Mpmc Lab Manual to Print

Ex. No: 18 FACTORIAL

AIM:

To write an assembly language program to calculate factorial of n-numbers

using 8086 microprocessor kit.

APPARATUS REQUIRED:

• 8086 Microprocessor Kit

• Power Chord

• Key Board

ALGORITHM:

Step 1: Start the program.

Step2: Move immediately the number 0000H to AX register.

Step3: Copy the contents of the memory 3000 to CX register.

Step4: Move immediately the number 0001H to AX register.

Step5: Multiply the content of the CX register with the content of accumulator.

Step6: Decrement the content of CX register once.

Step7: Jump to specified memory location if there is no zero in CX register.

Step8: Copy the content to AX register to two memories from 2000.

Step10: End.

Page 80: Mpmc Lab Manual to Print

MNEMONICS:

MOV AX, 0001

MOV CX, [3000]

MOV AX, 0001

Loop1 MUL CX

DEC CX

JNZ loop1

MOV [2000], AX

HLT

TABLE: 1

Memory LabelMnemonics

DescriptionInstruction Operand

1000

1004

1006

100A

100B

100C

100E

1012

loop1

MOV

MOV

MOV

MUL

DEC

JNZ

MOV

HLT

AX, 0001

CX, [3000]

AX, 0001

CX

CX

loop1

[2000], AX

Move immediately the number

0001H to AX register

Copy the contents of memory 3000 to

CX register

Move immediately the number

0000H to AX register

Multiply content of CX register with

content of accumulator

Decrement content of CX register

once

Jump to specified memory location if

there is no zero in CX register

Copy content to AX register to

memory 2000

Halt

Page 81: Mpmc Lab Manual to Print

OUTPUT:

INPUT DATA: OUTPUT DATA:

3000: 0008 2000: 9d80

RESULT:

Thus an assembly language program to calculate factorial of n-numbers was

written and executed using 8086 microprocessor kit.

Page 82: Mpmc Lab Manual to Print

Ex. No: 19 SORTING IN ASCENDING ORDER

AIM:

To write an assembly language program to sort n-numbers in ascending order

using 8086 microprocessor kit.

APPARATUS REQUIRED:

• 8086 Microprocessor Kit

• Power Chord

• Key Board

ALGORITHM:

Step 1: Start the program.

Step2: Load data’s into the memory.

Step3: Set the conditions to sort n-numbers in ascending order.

Step4: Sort the ‘n’ given numbers in ascending order.

Step5: Store the result in the memory.

Step6: Display the sorted result from memory.

Step7: End.

Page 83: Mpmc Lab Manual to Print

MNEMONICS:

MOV BX, 2000

MOV CX, [BX]

MOV CH, CL

Loop2 INC BX

INC BX

MOV AX, [BX]

INC BX

INC BX

CMP AX, [BX]

JC loop1

MOV DX, [BX]

MOV [BX], AX

DEC BX

DEC BX

MOV [BX], DX

INC BX

INC BX

Loop1 DEC BX

DEC BX

DEC CL

JNZ loop2

MOV BX, 2000

MOV CH, CL

DEC CH

JNZ loop2

HLT

Page 84: Mpmc Lab Manual to Print

TABLE: 1

Memory LabelMnemonics

DescriptionInstruction Operand

1000

1004

1006

1008

1009

100A

100C

100D

100E

1011

1013

1015

1017

1018

1019

101B

101C

101D

101E

101F

1020

Loop2

Loop1

MOV

MOV

MOV

INC

INC

MOV

INC

INC

CMP

JC

MOV

MOV

DEC

DEC

MOV

INC

INC

DEC

DEC

DEC

JNZ

BX, 2000

CX, [BX]

CH, CL

BX

BX

AX, [BX]

BX

BX

AX, [BX]

loop1

DX, [BX]

[BX], AX

BX

BX

[BX], DX

BX

BX

BX

BX

CL

loop2

Move2000 to BX register

Move BX memory data to CX register

Move data from CL to CH

Increment BX register content once

Increment BX register content once

Move BX memory data to AX

register

Increment BX register content once

Increment BX register content once

Compare AX register content and

BX memory

Jump to specified memory location

if carry is 1

Move BX memory data to DX

register

Move data from AX register to BX

memory data

Decrement BX register content once

Decrement BX register content once

Move data from DX register to BX

memory data

Increment BX register content once

Increment BX register content once

Decrement BX register content once

Decrement BX register content once

Decrement CL register content once

Jump to specified memory location

if there is no zero in CX register

Page 85: Mpmc Lab Manual to Print

1022

1026

1028

1029

102B

MOV

MOV

DEC

JNZ

HLT

BX, 2000

CH, CL

CH

loop2

Move2000 to BX register

Copy CL register data to CH register

Decrement CH register content once

Jump to specified memory location

if there is no zero in CX register

Halt

OUTPUT:

INPUT DATA: OUTPUT DATA:

2000: 0004 2002: 0001

2002: 0003 2004: 0002

2004: 0005 2006: 0003

2006: 0004 2008: 0004

2008: 0002 200A: 0005

200A: 0001

RESULT:

Thus an assembly language program to sort n-numbers in ascending order was

written and executed using 8086 microprocessor kit.

Page 86: Mpmc Lab Manual to Print

Ex. No: 20 SOLVING AN EXPRESSION

AIM:

To write an assembly language program for solving an expression using 8086

microprocessor kit.

APPARATUS REQUIRED:

• 8086 Microprocessor Kit

• Power Chord

• Key Board

ALGORITHM:

Step 1: Start the program.

Step2: Load data’s from memory to AX register.

Step3: Set the conditions to solve an expression.

Step4: Solve the expression given below using the conditions assumed.

Step5: Store the result in the memory.

Step6: Display the sorted result from memory.

Step7: End.

Page 87: Mpmc Lab Manual to Print

MNEMONICS:

MOV BX, [2000]

MUL AX

MOV BX, [2002]

MUL BX

MOV [3000], AX

MOV AX, [2000]

MOV BX, [2004]

MUL BX

ADD AX, [3000]

ADD AX, 0001

MOV [2006], AX

HLT

Page 88: Mpmc Lab Manual to Print

TABLE: 1

Memory LabelMnemonics

DescriptionInstruction Operand

1000

1004

1005

1009

100A

100E

1012

1016

1017

101B

101F

1023

MOV

MUL

MOV

MUL

MOV

MOV

MOV

MUL

ADD

ADD

MOV

HLT

AX, [2000]

AX

BX, [2002]

BX

[3000], AX

AX, [2000]

BX, [2004]

BX

AX, [3000]

AX, 0001

[2006], AX

Move data from memory 2000 to

AX register

Multiply content of AX register with

content of AX register

Move data from memory 2002 to

BX register

Multiply content of BX register with

content of AX register

Copy content to AX register to

memory 3000

Move data from memory 2000 to

AX register

Move data from memory 2004 to

BX register

Multiply content of BX register with

content of AX register

Add content of memory 3000 with

content of AX register

Add the number 0001 to AX

register

Copy content to AX register to

memory 2006

Halt

Page 89: Mpmc Lab Manual to Print

OUTPUT:

INPUT DATA: OUTPUT DATA:

2000: 0002 2006: 1F

2002: 0004

2004: 0007

RESULT:

Thus an assembly language program for solving an expression was written

and executed using 8086 microprocessor kit.

Page 90: Mpmc Lab Manual to Print

Ex No: 21 SUM OF N NUMBERS IN AN ARRAY

AIM:

To write a program to find sum of n numbers in an array.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit

• Power Chord

ALGORITHM:

Step1: Start the program.

Step2: Initialize the counter.

Step3: Get the first number.

Step4: Decrement the counter.

Step5: Load the base address of an array in to BX

Step6: By using the loop get the next number in to DX and add it with AX.

Step7: Increment the pointer and decrement the counter.

Step8: If the counter value is not equal to zero then go to step6

Step9: Else store the result.

Step10:Stop the program.

Page 91: Mpmc Lab Manual to Print

MNEMONICS:

MOV CL,[2000]

MOV AX,[2002]

DEC CL

XOR D1,D1

LEA BX,[2004]

LOOP1 MOV DX,[BX+D1]

ADD AX,BX

INC D1

INC D1

DEC CL

JNZ LOOP1

MOV [3000],AX

HLT

TABLE:

LABEL OPCODE OPERAND DESCRIPTION

LOOP 1

MOV

MOV

DEC

XOR

LEA

MOV

ADD

INC

INC

DEC

JNZ

MOV

HLT

CL,[2000]

AX,[2002]

CL

D1,D1

BX,[2004]

DX,[BX+DI]

AX,BX

DI

DI

CL

LOOP 1

[3000],AX

Move the memory content to CL.

Move the memory content to AX

Decrement the CL register.

XOR,D1 registers

Move the content of 2004 to BX

Move the content of BX+D1 to DX

Add AX with DX content.

Increment D1

Increment D1

Decrement CL

If zero flag is reseted go to loop1

Move the content to memory

location

Halt

Page 92: Mpmc Lab Manual to Print

OUTPUT:

INPUT DATA: OUTPUT DATA:

2000:0003 3000:0006

2002:0002

2004:0003

2006:0001

RESULT:

Thus the sum of n numbers in an array has been done using 8086 microprocessor

and the output is verified.

Page 93: Mpmc Lab Manual to Print

8051 MICROCONTROLLER

PROGRAMMING

Page 94: Mpmc Lab Manual to Print

EXPT NO:22

8 BIT ADDITION

AIM:

To write a program to add two 8-bit numbers using 8051 microcontroller.

APPARATUS REQUIERED

8051 Microcontroller kit. Power chord.

ALGORITHM:

1. Clear Program Status Word.

2. Select Register bank by giving proper values to RS1 & RS0 of PSW.

3. Load accumulator A with any desired 8-bit data.

4. Load the register R 0 with the second 8- bit data.

5. Add these two 8-bit numbers.

6. Store the result.

7. Stop the program.

8 Bit Addition (Immediate Addressing)

ADDRESS LABEL MNEMONIC OPERAND HEX CODE COMMENTS

4100 CLR C C3 Clear CY Flag

4101 MOV A, data1 74,data1 Get the data1 in Accumulator

4103 ADDC A, # data 2 24,data2 Add the data1 with data2

4105 MOV DPTR, # 4500H 90,45,00 Initialize the memory location

Page 95: Mpmc Lab Manual to Print

4108 MOVX @ DPTR, A F0 Store the result in memory location

4109 L1 SJMP L1 80,FE Stop the program

OUTPUT

OUTPUT

MEMORY LOCATION DATA

4500

RESULT:

Thus the 8051 ALP for addition of two 8 bit numbers is executed.

Page 96: Mpmc Lab Manual to Print

EXPT NO:23

8 BIT SUBTRACTION

AIM:

To perform subtraction of two 8 bit data and store the result in memory.

APPARATUS REQUIERED

8051 Microcontroller kit. Power chord.

ALGORITHM:

a. Clear the carry flag.b. Initialize the register for borrow. c. Get the first operand into the accumulator.d. Subtract the second operand from the accumulator. e. If a borrow results increment the carry register.f. Store the result in memory.

PROGRAMADDRESS LABEL MNEMONIC OPERAND HEX CODE COMMENTS

4100 CLR C C3 Clear CY flag

4101 MOV A, # data1 74, data1 Store data1 in accumulator

4103 SUBB A, # data2 94,data2 Subtract data2 from data1

4105 MOV DPTR, # 4500 90,45,00 Initialize memory location

4108 MOVX @ DPTR, A F0 Store the difference in memory location

4109 L1 SJMP L1 80,FE Stop

Page 97: Mpmc Lab Manual to Print

OUTPUT

RESULT

Thus the 8051 ALP for subtraction of two 8 bit numbers is executed.

OUTPUT

MEMORY LOCATION

DATA

4500

Page 98: Mpmc Lab Manual to Print

EXPT NO:24

8 BIT MULTIPLICATION

AIM:

To perform multiplication of two 8 bit data and store the result in memory.

APPARATUS REQUIERED

8051 Microcontroller kit. Power chord.

ALGORITHM:

a. Get the multiplier in the accumulator.b. Get the multiplicand in the B register.c. Multiply A with B.d. Store the product in memory.

PROGRAM

ADDRESS LABEL MNEMONIC OPERAND HEX CODE

COMMENTS

4100 MOV A ,#data1 74, data1

Store data1 in accumulator

4102 MOV B, #data2 75,data2

Store data2 in B reg

4104 MUL A,B F5,F0 Multiply both

4106 MOV DPTR, # 4500H

90,45,00

Initialize memory location

4109 MOVX @ DPTR, A F0 Store lower order

Page 99: Mpmc Lab Manual to Print

result

401A INC DPTR A3 Go to next memory location

410B MOV A,B E5,F0

Store higher order result

410D MOV @ DPTR, A F0

410E STOP SJMP STOP 80,FE Stop

OUTPUT

INPUT OUTPUT

MEMORY LOCATION DATA MEMORY LOCATION DATA

4500 4502

4501 4503

RESULT:

Thus the 8051 ALP for multiplication of two 8 bit numbers is executed.

Page 100: Mpmc Lab Manual to Print

EXPT NO:25

8 BIT DIVISION

AIM:

To perform division of two 8 bit data and store the result in memory.

APPARATUS REQUIERED

8051 Microcontroller kit. Power chord.

ALGORITHM:

1. Get the Dividend in the accumulator.2. Get the Divisor in the B register.3. Divide A by B.4. Store the Quotient and Remainder in memory.

PROGRAM

ADDRESS LABEL MNEMONIC OPERAND HEX CODE

COMMENTS

4100 MOV A, # data1 74,data1

Store data1 in accumulator

4102 MOV B, # data2 75,data2

Store data2 in B reg

4104 DIV A,B 84 Divide

4015 MOV DPTR, # 4500H

90,45,00

Initialize memory location

4018 MOVX @ DPTR, A F0 Store remainder

Page 101: Mpmc Lab Manual to Print

4109 INC DPTR A3 Go to next memory location

410A MOV A,B E5,F0

Store quotient

410C MOV @ DPTR, A F0

410D STOP SJMP STOP 80,FE Stop

RESULT:

INPUT OUTPUT

MEMORY LOCATION DATA MEMORY LOCATION DATA

4500 (dividend) 4502 (remainder)

4501 (divisor) 4503 (quotient)

RESULT:

Thus the 8051 ALP for division of two 8 bit numbers is executed.

Page 102: Mpmc Lab Manual to Print

Ex. No: 26 16 BIT ADDITION

AIM:

To write an assembly language program to add the two 16 bit data’s using

8051 Micro controller.

APPARATUS REQUIRED:

• 8051 Microcontroller kit.

• Power chord.

ALGORITHM:

Step1: Start the program.

Step2: Load the lower byte of the two data’s into accumulator and R0 register.

Step3: Add the two data’s.

Step4: Move the added data into R6 register and initialize the R2 register.

Step5: Load the higher byte of the two data’s into accumulator and R1 register.

Step6: Add the two data’s with carry.

Step7: If carry comes, increment R2 register content once.

Step8: Store the accumulator data and R6 and R2 register data’s into the memory.

Step9: Stop the program.

Page 103: Mpmc Lab Manual to Print

MNEMONICS:

MOV DPTR,#4400

MOVX A,@D P TR

MOV R0,A

MOV R2,#00

INC DPTR

MOVX A,@D P TR

MOV R1,A

INC DPTR

MOVX A,@D P TR

ADD A,R0

MOV R6,A INC

DPTR

MOVX A,@D P TR

ADDC A,R1

JNC LOOP1

INC R2

LOOP1: INC DPTR

MOVX @D P T R,A

INC DPTR

MOV A,R6

MOVX @D P T R,A

INC DPTR

MOV A,R2

MOVX @D P T R,A

LOOP2: SJMP LOOP2

Page 104: Mpmc Lab Manual to Print

TABLE:

Memory Label MNEMONICS Hex

codeDescription

4100

4101

4102

4103

4104

4105

4106

4107

4108

4109

410A

410B

410C

410D

410E

410F

4110

4111

MOV DPTR,#4400

MOVX A,@D P TR

MOV R0,A

MOV R2,#00

INC DPTR

MOVX A,@D P TR

MOV R1,A

INC DPTR

MOVX A,@D P TR

ADD A,R0

MOV R6,A

INC DPTR

MOVX A,@D P TR

ADDC A,R1

JNC LOOP1

90

44

00

E0

F8

7A

00

A3

E0

F9

A3

E0

28

FE

A3

E0

39

50

Move data 4400 to DPTR

Move data from DPTR to Accumulator.

Move data from Accumulator to R0

register.

Clear the R2 register.

Increment DPTR content once.

Load the data from DPTR to

Accumulator.

Move the data to R1 register from

Accumulator.

Increment DPTR content once.

Load the data from DPTR to

Accumulator.

Add Accumulator data and R0 register

data.

Move data from Accumulator to R6

register.

Increment DPTR content once.

Load the data from DPTR to

Accumulator.

Add Accumulator data and R0 register

data with carry.

Jump when carry=0 to loop1.

Page 105: Mpmc Lab Manual to Print

4112

4113

4114

4115

4116

4117

4118

4119

411A

411B

411C

411D

411E

Loop1

Loop2

INC R2

INC DPTR

MOVX @D P T R,A

INC DPTR

MOV A,R6

MOVX @D P T R,A

INC DPTR

MOV A,R2

MOVX @D P T R,A

SJMP LOOP2

01

0A

A3

F0

A3

EE

F0

A3

EA

F0

80

41

1C

Increment the content of R2 register

once.

Increment DPTR content once.

Store the Accumulator data to DPTR.

Increment DPTR content once.

Move the data from R6 register to

Accumulator.

Store the Accumulator data to DPTR.

Increment DPTR content once.

Move the data from R2 register to

Accumulator.

Store the Accumulator data to DPTR.

Jump to loop2.

OUTPUT:

INPUT DATA: OUTPUT DATA:

4400: 23 4404: A6

4401: 32 4405: 6A

4402: 47 4406: 00

4403: 74

RESULT:

Thus an assembly language program to add two 16-bit data’s was written and

executed using 8051 micro controller kit.

Page 106: Mpmc Lab Manual to Print

Ex. No: 27 16 BIT SUBTRACTION

AIM:

To write an assembly language program to subtract the two 16 bit data’s using

8051 Micro controller.

APPARATUS REQUIRED:

• 8051 Microcontroller kit.

• Power chord.

ALGORITHM:

Step1: Start the program.

Step2: Load the lower byte of the two data’s into accumulator and R0 register.

Step3: Subtract the two data’s.

Step4: Move the subtracted data into R6 register and initialize the R2 register.

Step5: Load the higher byte of the two data’s into accumulator and R1 register.

Step 6: Subtract the two data’s with borrow.

Step7: If carry comes, increments R2 register content once.

Step8: Store the accumulator data and R6 and R2 register data’s into the memory.

Step9: Stop the program.

Page 107: Mpmc Lab Manual to Print

MNEMONICS:

MOV

MOVX

MOV

MOV

INC

MOVX

MOV

INC

MOVX

SUBB

MOV

INC

MOVX

SUBB

JNC

INC

DPTR,#4400

A,@D P TR

R0,A

R2,#00

DPTR

A,@D P TR

R1,A

DPTR

A,@D P TR

A,R0

R6,A

DPTR

A,@D P TR

A,R1

LOOP1

R2

LOOP1: INC DPTR

MOVX @D P T R,A

INC DPTR

MOV A,R6

MOVX @D P T R,A

INC DPTR

MOV A,R2

MOVX @D P T R,A

LOOP2: SJMP LOOP2

Page 108: Mpmc Lab Manual to Print

TABLE:

Memory Label Mnemonics Hex

codeDescription

4100

4101

4102

4103

4104

4105

4106

4107

4108

4109

410A

410B

410C

410D

410E

410F

4110

4111

MOV DPTR,#4400

MOVX A,@D P TR

MOV R0,A

MOV R2,#00

INC DPTR

MOVX A,@D P TR

MOV R1,A

INC DPTR

MOVX A,@D P TR

SUBB A,R0

MOV R6,A

INC DPTR

MOVX A,@D P TR

SUBB A,R1

JNC LOOP1

90

44

00

E0

F8

7A

00

A3

E0

F9

A3

E0

98

FE

A3

E0

99

50

Move data 4400 to DPTR

Move data from DPTR to Accumulator.

Move data from Accumulator to R0

register.

Clear the R2 register.

Increment DPTR content once.

Load the data from DPTR to

Accumulator.

Move the data to R1 register from

Accumulator.

Increment DPTR content once.

Load the data from DPTR to

Accumulator.

Subtract Accumulator data and R0

register data.

Move data from Accumulator to R6

register.

Increment DPTR content once.

Load the data from DPTR to

Accumulator.

Subtract Accumulator data and R0

register data with carry.

Jump when carry=0 to loop1.

Page 109: Mpmc Lab Manual to Print

4112

4113

4114

4115

4116

4117

4118

4119

411A

411B

411C

411D

411E

Loop1

Loop2

INC R2

INC DPTR

MOVX @D P T R,A

INC DPTR

MOV A,R6

MOVX @D P T R,A

INC DPTR

MOV A,R2

MOVX @D P T R,A

SJMP LOOP2

01

0A

A3

F0

A3

EE

F0

A3

EA

F0

80

41

1C

Increment the content of R2 register

once.

Increment DPTR content once.

Store the Accumulator data to DPTR.

Increment DPTR content once.

Move the data from R6 register to

Accumulator.

Store the Accumulator data to DPTR.

Increment DPTR content once.

Move the data from R2 register to

Accumulator.

Store the Accumulator data to DPTR.

Jump to loop2.

OUTPUT:

INPUT DATA: OUTPUT DATA:

4500: BC 4504: 80

4501: 19 4505: 34

4502: 88 4506: 01

4503: 99

RESULT:

Thus an assembly language program to subtract two 16-bit data’s was written

and executed using 8051 micro controller kit.

Page 110: Mpmc Lab Manual to Print

Ex. No: 28 16 BIT MULTIPLICATION

AIM:

To write an assembly language program to multiply two 16 bit data’s using

8051 Micro controller.

APPARATUS REQUIRED:

• 8051 Microcontroller kit.

• Power chord.

ALGORITHM:

Step1: Start the program.

Step2: Load the two data’s into Accumulator and B register.

Step3: Multiply the two data’s.

Step4: Store the result into the memory.

Step5: Stop the program.

MNEMONICS:

MOV DPTR,#4400

MOVX A,@D P TR

MOV 0F0,A

INC DPTR

MOVX A,@D P TR

MUL AB

INC DPTR

MOVX @D P T R,A

INC DPTR

MOV A,0F0

MOVX @D P T R,A

LOOP1: SJMP LOOP1

Page 111: Mpmc Lab Manual to Print

TABLE: 1

Memory Label Mnemonics Hex

codeDescription

4100

4101

4102

4103

4104

4105

4106

4107

4108

4109

410A

410B

410C

410D

410E

410F

4110

4111

Loop2

MOV DPTR,#4400

MOVX A,@D P TR

MOV 0F0,A

INC DPTR

MOVX A,@D P TR

MUL AB

INC DPTR

MOVX @D P T R,A

INC DPTR

MOV A,0F0

MOVX @D P T R,A

SJMP LOOP1

90

44

00

E0

F5

F0

A3

E0

A4

A3

F0

A3

E5

F0

F0

80

41

1C

Move data 4400 to DPTR

Move data from DPTR to Accumulator.

Move data from Accumulator to B register.

Increment DPTR content once.

Move data from DPTR to Accumulator.

Multiply the Accumulator content and B

register.

Increment DPTR content once.

Store the Accumulator content to DPTR.

Increment DPTR content once.

Move the data from B register to

Accumulator.

Store the Accumulator content to DPTR.

Jump to loop1.

Page 112: Mpmc Lab Manual to Print

OUTPUT:

INPUT DATA: OUTPUT DATA:

4400: 23 4404: 6D

4401: 32 4405: 06

RESULT:

Thus an assembly language program to multiply two data’s was written and

executed using 8051 micro controller kit.

Page 113: Mpmc Lab Manual to Print

Ex. No: 29 16 BIT DIVISION

AIM:

To write an assembly language program to divide two 16 bit data’s using 8051

Micro controller.

APPARATUS REQUIRED:

• 8051 Microcontroller kit.

• Power chord.

ALGORITHM:

Step1: Start the program.

Step2: Load the two data’s into Accumulator and B register.

Step3: Divide the two data’s.

Step4: Store the result into the memory.

Step5: Stop the program.

MNEMONICS:

MOV DPTR,#4400

MOVX A,@D P TR

MOV 0F0,A

INC DPTR

MOVX A,@D P TR

DIV AB

INC DPTR

MOVX @D P T R,A

INC DPTR

MOV A,0F0

MOVX @D P T R,A

LOOP1: SJMP LOOP1

Page 114: Mpmc Lab Manual to Print

TABLE: 1

Memory Label Mnemonics Hex

codeDescription

4100

4101

4102

4103

4104

4105

4106

4107

4108

4109

410A

410B

410C

410D

410E

410F

4110

4111

Loop2

MOV DPTR,#4400

MOVX A,@D P TR

MOV 0F0,A

INC DPTR

MOVX A,@D P TR

DIV AB

INC DPTR

MOVX @D P T R,A

INC DPTR

MOV A,0F0

MOVX @D P T R,A

SJMP LOOP1

90

44

00

E0

F5

F0

A3

E0

84

A3

F0

A3

E5

F0

F0

80

41

1C

Move data 4400 to DPTR

Move data from DPTR to Accumulator.

Move data from Accumulator to B register.

Increment DPTR content once.

Move data from DPTR to Accumulator.

Divide the Accumulator content and B

register.

Increment DPTR content once.

Store the Accumulator content to DPTR.

Increment DPTR content once.

Move the data from B register to

Accumulator.

Store the Accumulator content to DPTR.

Jump to loop1.

Page 115: Mpmc Lab Manual to Print

OUTPUT:

INPUT DATA: OUTPUT DATA:

4400: ED 4404: 06

4401: 23 4405: 1B

RESULT:

Thus an assembly language program to divide two data’s was written and

executed using 8051 microcontroller kit.

Page 116: Mpmc Lab Manual to Print

INTERFACING PROGRAMS

Page 117: Mpmc Lab Manual to Print

Ex. No: 30 STEPPER MOTOR INTERFACING

AIM:

To write a program fro inter facing stepper motor and to run the motor in

different directions and in different speeds.

ALGORITHM:

Step1: Start the program.

Step2: Load HL register pair with memory address at look up.

Step3: Move the contents of HL pair to accumulator.

Step4: Out the contents of accumulator to run the motor.

Step5: Decrease b register. If register content is not zero then rotate the motor

continuously.

Step6: If zero then move to the Seginning of the program.

Step7: Stop the process.

THEORY:

STEPPER MOTOR:

A motor in which the rotor is able to assume only discrete stationary angular

position is a Stepper Motor. The rotary motion in a stepper motor is a stepwise

manner from one equilibrium position to another.

CONSTRUCTIONAL FEATURES:

A stepper motor could be either of the reluctance type or of the permanent

magnet type (PM). A PM stepper consists of multiphase stator and two part

permanent magnet rotor. The VR stepper motor has unmagnetised rotor. PM stepper

motor is the most commonly used type. The basic two phase stepper motor consists of

two pairs of stator poles. Each of the four poles has its own winding. The excitation

Page 118: Mpmc Lab Manual to Print

MP & MC – LAB MANUAL ECE Page 102

of any winding generates a north pole (N), a south pole (S) gets induced at the

diametrically opposite side.

As shown in the figure the four pole structure is continuous with the stator

frame and the magnetic field passes through the cylindrical stator annular ring. The

rotor magnetic system has two end faces. The left face is permanently magnetized as

South Pole and their right face as North Pole. The South Pole structure and the North

Pole structure posses similar pole faces. The north pole structure is twisted with

respect to the south pole structure by one pole pitch.

Stepper Motor Cross-sectional View

|

Page 119: Mpmc Lab Manual to Print

In an arrangement where four stator poles and three poles of rotor poles, there exists

12 possible positions in which a south pole of the rotor can lock with a north pole of

the stator. From this it can be rotated that the step size is

360o

=

Ns*Nr

where, Ns is the number of stator pole pairs

Nr is the number of pairs rotor pole

Generally step size of the stepper motor depends upon NR. These stable

positions can be attained by simply energizing the winding on any one of the stator

poles with a DC. There are three different schemes available for ‘stepping’ a stepper

motor. They are,

a) Wave Scheme

b) 2-Phase scheme

c) Half stepping or mixed scheme

2-PHASE SCHEME:

In this scheme any two adjacent stator windings are energized. There are two

magnetic fields active in quadrature and none of the rotor pole faces can in direct

alignment with the stator poles. A partial but symmetric alignment of the rotor poles

is of course possible.

Page 120: Mpmc Lab Manual to Print

Typical equilibrium conditions of the rotor when the windings on two

successive stator poles are excited are illustrated. In Step (a) A1 and B1 are

energized. The pole-face S1 tries to align itself with the axis of A1 (N) and the pole-

face S2 with B1 (N). The North Pole N3 of the rotor finds itself in neutral zone

between A1 (N) and B1 (N). S1 and S2 of the rotor position themselves

symmetrically with respect to the two stator north pole.

Next when B1 and A2 are energized S2 tends to align with B1 (N) and S3

with A2 (N) of course. Again under equilibrium conditions only partial alignment is

possible and N1 finds itself in the neutral region midway between B1 (N) and A2 (N)

[Step (b)]. In Step (c), A2(N) and B2(N), respectively, with N2 in the neutral zone.

Step (d) illustrates the case when A1 and B2 are ON.

The step angle is 30ْ as in the two phase’s scheme. However the rotor is offset

by 15 ْ in the two phase’s scheme with respect to the wave scheme. A total of 12 steps

are required to move the rotor by 360 ْ (mechanical) Two Phases drives produce more

torque than the wave drives.

MNEMONICS:

START: LXI H, LOOK UP

MVI B, 04

REPT: MOV A, M

OUT 0C0H

LXI D, 0303H

DELAY: NOP

DCX D

MOV A, E

ORA D

JNZ DELAY

INX H

DCR B

JNZ REPT

JMP START

LOOK UP: DB 09 05 06 0A

Page 121: Mpmc Lab Manual to Print

TABLE: 1

LOOK UP TABLE

Step

Anticlockwise Clockwise

A1 A2 B1 B2 A1 A2 B1 B2

1 1 0 0 1 1 0 1 0

2 0 1 0 1 0 1 1 0

3 0 1 1 0 0 1 0 1

4 1 0 1 0 1 0 0 1

TABLE: 2

Memory LabelMnemonics HEX

CODE

Description

Instruction Operand

4100

4101

4102

4103

4014

4105

4106

4107

4108

4109

410A

410B

410C

410D

410E

410F

4110

START:

REPT:

DELAY:

LXI

MVI

MOV

MOV

LXI

NOP

DCX

MOV

ORA

JNZ

H, LOOK UP

B,04

A,M

[2000], AX

D, 0303H

D

A,E

D

410B

21

1A

41

06

04

7E

03

C0

11

03

03

00

1B

7B

B2

C2

0B

Load HL pair with memory address

at Look Up

Move immediate the given data

to B register

Move content of memory to Acc.

Out the content of Accumulator

to C0 port address

Load the data 0303H to D register

Perform No operation

Decrement address of DE pair once

Move E register content to Acc.

Perform OR operation With Acc.

Jump on no zero to the

instruction at specified memory

Page 122: Mpmc Lab Manual to Print

4111

4112

4113

4114

4115

4116

4117

4118

4119

411A

INX

DCR

JNZ

JMP

LOOK

H

B

START

UP

41

23

05

C2

05

41

C3

00

41

09

05

06

04

Address

Increment HL pair address once

Decrement B register content once

Jump on no zero to the

instruction at specified memory

Address

Jump to the instruction at

specified memory

Data will be stored in the location

RESULT:

Thus the stepper motor is rotated by varying the speed using COUNT

operation and its direction is also changed using program written and executed using

8085 micro processor kit.

Page 123: Mpmc Lab Manual to Print

Ex. No: 31 INTERFACING WITH PROGRAMMABLE

INPUT OUTPUT – 8255

AIM:

To initialize port A as input port and port B as output port in mode 0.To input

the data at port A and set by the spot switches and to output the same data to port B to

glow the LEDS accordingly.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit

• 8255 microprocessor programmable input/output

• Power Chord

• 8b call cable

PRODUCTION:

The 8255 has been displayed as general purpose programmable I/O device

compatible with intel inputs. It contains three 8 bit parts which can be configured by

software means to provide any one of the three programmable data transfer available

with 8255.

PORT A

One 8 bit data output latch/ buffer and one 8 bit data input latch. Port A can

function as input or output ports in three modes. The details are given in the following

section.

PORT B

One 8 bit data output latch/ buffer and one 8 bit data input latch. Port B can

function as input or output ports in two modes.

Page 124: Mpmc Lab Manual to Print

PORT C

One 8 bit data output latch/ buffer and one 8 bit data input latch. Port C can

function as simple input or output port. Thus port can be divided into two four bit

ports which intern can function as sample input or output port. In addition the port C

line can be used for the control signal outputs and the status signal outputs in

conjunction with port A and port B.

GROUP A AND GROUP B CONTROLS:

The three ports of 8255 have been divided into two groups group A and group

B. Group A contains port B and port C higher address lines. Group B contains port B

and port C lower address lines.

The ports are configured as input are output by command window contains

information such as “mode”, “bit set” etc. In short command window decides.

Whether the port is input port or output port and modes of transfer through a port.

Each of the control blocks accepts command to its associated ports.

CONFIGURATION 8255 WITH A MICROPROCESSOR:

The 8255 has all the necessary hardware for direct interfacing with 8116 bit

bus. Data communication and configuration for direct data transfer can be done using

the fal registers, namely three ports A, B and E and the control register available in

the chip, register can be accessed with the help of A0 and A1 pin lines which are

connected to the lower order bits A1 and A2 of the 8 bit microprocessor unit. The

port registers are read / write register where as write registers is a control register.

PROGRAMMING THE 8255:

The control word can be programmed to configure the ports in a write variety

of functional characteristics, the mode definition format is shown.

Port lines have been divided into two groups: Group A and Group B. Group A

can be configured in these modes, mode 0, mode 1 and mode 2 where as group B can

be configured into two modes mode 0 and mode 1.

Page 125: Mpmc Lab Manual to Print

The control word is 8 bit wide. Bit 7 decides whether the mode set of

operation in bit set and reset operation is selected.

With Bit 7=1 Bit 6,5,4 and 3 to set the modes of group A while Bit 2,1 and 0

are to set the modes of group B. Detailed operation will be discussed later.

PROCEDURE:

Initialise the port A as input port and out to control read input from port A and

out to the control port B. store the content of Accumulator in add 4500.

MNEMONICS:

ORG 4100H

MVI A,90

OUT 0C6H

OUT C6H

IN COH

STA 4500H

HLT

OBSERVATION:

Enter the program starting from the USER RAM address set a known data at

the spot switches. Execute the program. The Above program initialises port A as an

input port and port B as an out port. The data set by SPOT switches setting is input to

the accumulator and is outputted to port B and the data output at the LEDs is the

same, as that set by the SPOT switches settings. This input value from the

accumulator is stored at 4500H.

RESULT:

Thus a program to initialise port A as input port and port B as output port in

mode 0 in processor 8255 was performed and their output was verified.

Page 126: Mpmc Lab Manual to Print

Ex. No: 32 INTERFACING WITH KEYBOARD DISPLAY

CONTROLLER - 8279

INTRODUCTION:

The INTEL 8279 is responsible for debouncing of the keys,

coding of the keyboard matrix and refreshing of the display elements in a

microprocessor based development system.

Its main features are

• Simultaneous keyboard and display operation.

• Three input modes such as scanned keyboard mode , scanned sensor mode

and stored input entry mode.

• R output mode such as 8 or 16 bit character multiplexed display right entry or

left entry display format.

• Clock puscalar

• Programmable scan timing

• 2 key increment facility for easy programming.

• Auto increment facility for easy programming.

• The 8279 is designed specifically to connect to any CPU to do some other

Work other than scanning the keyboard and refreshing the display. This CPU

can program the operating modes for 8279.It uses the CS, A0, RD and WR

lines to control data. How to and from various internal registers and buffer as

given in table.

SEGMENT DEFINITION:

Segment definitions of the seven segment display are shown below. The

correspondence between the data bus and output port bits 8279.Also the segment

relationship with these given in table 1.

Page 127: Mpmc Lab Manual to Print

D0 bit of the byte sent to the display RAM corresponds to B0 and D7 of the

byte sent to the display corresponds AB. Inorder to right up a segment the

corresponding bit of data are written into the RAM should be a 0.

DISPLAY MODE SETUP:

DD DISPLAY MODE:

00-8 8 bit character display-left entry

01-16 8 bit character display- left entry

10-8 8 bit character display- right entry

11-16 8 bit character display-right entry

Kkk-KEYBOARD MODE:

000-Encoded scan keyboard-2 KEY LOCK OUT

001-Encoded scan keyboard-2 KEY LOCK OUT

010-Encoded scan keyboard-N key roll over

011-Decoded scan sensor matrix

100- Decoded scan keyboard –N key roll over

101- Decoded scan sensor matrix

110-Strobed input, Encoded Display scans

111-Strobed input, decoded display scan

WRITE DISPLAY RAM:

The write display RAM command word format is shown in table

1.AI auto increment flag .If AI=1,the row address selected will be incremented after

the each following read or write to the DISPLAY RAM

AAAA - select any one of the 16 rows of DISPLAY RAM.

Page 128: Mpmc Lab Manual to Print

READ FIFO STATUS:

The status word is read by the CPU when A0 is high and CS and RD are low.

FIFO status is used in the keyboard and strobed input modes to indicate whether an

error has occurred. There are two types of errors possible over run and under run over

run occur. when the entry of another character in to a full. FIFO is attempted. Under

RUN across when the CPU tried to read an empty FIFO. The FIFO status word also

has been at bit to indicate that the display RAM is unavailable because a clear display

or clear all comment has not completed is cleaning operation. The use of this flag is

clear the display.

In a sensor matrix SIE bit act as error flag and indicates whether a

simultaneous multiple closure error has occurred.SIE bit is set in FIFO status word to

indicate at least one sensor closure indication is contained in the sensor RAM.

READ FIFO/SENSOR RAM:

READ FIFO/SENSOR RAM control, word format is

given in a table 2. The CPU sets the 8279 for a read of the FIFO1 sensor RAM by

writing command word.

X - Don’t care

AI – auto increment flag irrelevant is scanned keyboard mode. For sensor

matrix mode. If AI=1, then successive read will be from subsequent row of the sensor

RAM.

AAA- In scanned keyboard mode, the 8279 will automatically drive the data bus for

subsequent read in the same sequence in which data first entered the FIFO.

READ A KEY:

PROCEDURE:

Set FIFO status check for a key and repeat the loop. Set 8279 for A and of

read of FIFO RAM store the content of accumulator at the memory address 4200

CNT EQU 0C2H; DAT EQU 0C0H.

Page 129: Mpmc Lab Manual to Print

MNEMONICS:

ORG 4100H

LOO IN CNT

ANI 07

JZ LOOP

MVI A, 40H

OUT CNT

IN DAT

STA 4200

HLT

OBSERVATION:

The key 0 is pressed and the data entered at FIFO RAM is W.

ROUTING DISPLAY:

PROCEDURE:

The initialization of 8279 to display the characters. The data is fetched from

address 412CH and displayed in the second digit of the display. Since in the

command word for “write display”. RAM the auto increment flag is set. A time delay

is given between successive digit to likely display.

MNEMONICS:

START LXI 412CH

MVI D,OFH

MVI A,10F

OUT 0C2H

MVI A,0CCH

OUT 0C2H

LOOP MOV A,M

OUT 0C0H

Page 130: Mpmc Lab Manual to Print

CALL DELAY

INX H

DCR D JNZ

LOOP JMP

START

DELAY MVI B,0A0H

LOOP1 MVI C,0FFH

LOOP2 DCR C

JNZ LOOP2

DCR C

JNZ LOOP1

RET

OBSERVATION:

The rolling message ‘HELP US’ is displayed in the display when the input

given is

412C FF FF FF FF

4130 FF FF FF FF

4134 98 68 70 08

4138 1C 29 FF FF

RESULT:

Thus a program to read akey and rolling display by interfacing 8085 with 8279 is

executed and the output is verified.

Page 131: Mpmc Lab Manual to Print
Page 132: Mpmc Lab Manual to Print
Page 133: Mpmc Lab Manual to Print
Page 134: Mpmc Lab Manual to Print
Page 135: Mpmc Lab Manual to Print