mpmc newmanual

186
AARUPADAI VEEDU INSTITUTE OF TECHNOLOGY PAIYANOOR LAB MANUAL MICROPROCESSORS AND MICROCONTROLLER LABORATORY DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING AARUPADAI VEEDU INSTITUTE OF TECHNOLOGY OLD MAHABALIPURAM ROAD

Upload: ajeyhareprasath

Post on 21-Feb-2015

21.279 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: mpmc newmanual

AARUPADAI VEEDU INSTITUTE OF TECHNOLOGY

PAIYANOOR

LAB MANUAL

MICROPROCESSORS AND MICROCONTROLLER

LABORATORY

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

AARUPADAI VEEDU INSTITUTE OF TECHNOLOGY

OLD MAHABALIPURAM ROAD

Page 2: mpmc newmanual

LIST OF EXPERIMENTS

1. Programming 8085.

2. Programming 8086.

3. Programming 8051.

4. Pc based control systems.

5. Stepper Motor Controller.

6. PC interfacing.

7. AC & DC Motor Speed Control.

Page 3: mpmc newmanual

LIST OF EXPERIMENTS

A.8085 Programming

1. Study of 8085 Microprocessor

2. 16 bit Addition, Subtraction, Multiplication and Division.

3. BCD to HEX and HEX to BCD code conversion.

4. Largest and smallest of a given set of numbers.

5. Square Root of 8-bit number.

B.8086 Programming

1. Study of 8086 Microprocessor

2. 32 bit Addition and Addition of 3*3Matrices.

3. Ascending Order and Descending Order.

4. Reversal of a String.

C. Interfacing Experiments

1. Keyboard and Display Interface

2. ADC Interface.

3. DAC Interface.

4. Stepper Motor Interface.

5. Traffic Signal Modeling.

D.8051 Programming

Study of 8051.

1. 8 Bit Arithmetic Operations.

Addition, Subtraction, Multiplication and Division

2. Addition of two sixteen bit numbers.

3. Transferring a Block of data from

(i). Internal to External memory.

(ii). External to External memory.

(iii). External to Internal memory.

4. 8-bit Conversion

(i).ASCII to its equivalent Hexa decimal and

(ii). Hexa decimal to its equivalent ASCII

5. Arrange the given numbers in ascending and descending order.

6. Filling External and Internal Memory.

E. Interfacing Experiments

1. DAC Interfacing.

2. Stepper Motor Interfacing.

Page 4: mpmc newmanual

Experiment No: Date:

ADDITION OF TWO 8-BIT NUMBERS

AIM:

Write a program to add two 8 bit numbers and store the result in memory location

4200 and 4201.

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with keyboard

(ii) Power cable.

ALGORITHM:

Step 1: Initialize register C to account for carry.

Step 2: The addend is brought to the accumulator.

Step 3: Move the augend to any one of the register.

Step 4: Perform the addition.

Step 5: Store the 8 bit and carry in two memory locations.

Step 6: Stop the process.

Page 5: mpmc newmanual

FLOWCHART

Start

Initialize C register to zero for carry

Get first data in Accumulator

Get second data in B register

ADD two numbers

Is carry NO

Flag

Set?

YES

Increment C register by one

Store the Sum & Carry in the desired memory locations

Stop

Page 6: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START 4100H MVI C,00H Initialize C reg. to store

carry.

4102H LXI H,4150H Initialize HL reg. pair to

point 1st data.

4105H MOV A,M Move 1st data to

accumulator.

4106H INX H Increment HL reg. pair to

point 2nd

data.

4107H MOV B,M Move 2nd

data to B reg.

4108H ADD B Add two numbers in A & B.

4109H JNC LOOP Check whether Carry Flag

is reset.

410CH INR C Increment C register.

LOOP 410DH STA 4200H Store 8 bit sum to memory

location 4200.

4110H MOV A,C Move carry to

Accumulator.

4111H STA 4201H Store carry to memory

4201.

4114H HLT Stop the process.

RESULT:

Thus the program for addition of two 8-bit numbers has been written and executed

and the sum is verified.

Page 7: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA- VOCE QUESTIONS

1. What is Microprocessor ?

2. What are the basic units of a microprocessor ?

3. What is a bus?

4. What is assembly language?

5. Why data bus is bi-directional?

Page 8: mpmc newmanual

Experiment No: Date:

SUBTRACTION OF TWO 8-BIT NUMBERS

AIM:

Write a program to subtract two 8 bit numbers and store the result in memory location

4502 and 4503.

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with keyboard

(ii) Power cable

ALGORITHM:

Step 1: Initialize register C to account for Borrow.

Step 2: The Minuend is brought to the accumulator.

Step 3: Move the subtrahend to anyone register.

Step 4: Perform the subtraction.

Step 5: If the carry flag is reset go to step 7, else proceed to the next step.

Step 6: Take 2’s complement of the accumulator content and increment C register.

Step 7: Store the difference & borrow in memory location 4502 and 4503.

Step 8: Stop the process.

Page 9: mpmc newmanual

FLOWCHART

Start

Initialize C register to zero for Borrow

Get Minuend in Accumulator

Get Subtrahend in any other register

Subtract Subtrahend from Accumulator

Is carry NO

Flag

Set?

YES

Take 2’s Complement of Accumulator& increment C Reg.

Store the Results in the desired memory locations

Stop

Page 10: mpmc newmanual

PROGRAM :

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START 4300H MVI C,00H Initialize C reg to store carry.

4302H LXI H,4500H Initialize HL reg pair to point

1st data.

4305H MOV A,M Move 1st data to accumulator.

4306H INX H Increment HL reg pair to point

2nd

data.

4307H MOV B,M Move 2nd

to register B.

4308H SUB B Subtract the subtrahend from

minuend.

4309H JNC SKIP If Carry Flag reset, go to skip.

430CH CMA If the Subtraction result in

borrow take 2’s complement of

the accumulator 430DH ADI 01H

430FH INR C Increment register C

SKIP 4310H INX H Store the result in the desired

memory location 4311H MOV M,A

4312H INX H Store the carry flag to indicate

whether the result is positive or

negative 4313H MOV M,C

4314H HLT Stop the process.

RESULT:

Thus the subtraction program has been written & executed and the difference and

borrow were verified.

Page 11: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA-VOCE QUESTIONS

1. Why address bus is unidirectional?

2. What is the data and address size in 8086?

3. Define machine cycle.

4. Define T-State

5. What is the difference between CPU bus and system bus?

Page 12: mpmc newmanual

Experiment No: Date:

MULTIPLICATION OF TWO 8-BIT NUMBERS

AIM:

To write an Assembly Language Program for the multiplication of two 8-bit numbers.

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with keyboard

(ii) Power cable.

ALGORITHM:

Step 1: Initialize the HL registers pair with the address 4200H.

Step 2: Clear C register.

Step 3: Get the multiplicand in accumulator and get the multiplier in B-reg.

Step 4: Move the Multiplicand to D register.

Step 5: Add the content of A register with the content of D register.

Step 6: Check the carry flag if CY=0 go to step 7 otherwise increment the C register.

Step 7: Decrement the B register.

Step 8: If the content of B reg is not equal to zero go to step 5, otherwise go to next

step.

Step 9: Store the content of accumulator in Next memory location.

Step 10: Store the higher order byte in next memory location.

Step 11; Stop the Process.

Page 13: mpmc newmanual

FLOWCHART

Start

Initialize the HL register pair and get the multiplicand in A & D

Get the multiplier in B-reg & decrement it by one

ADD accumulator (multiplicand) to D reg. content

NO

Is carry flag

Set?

YES

Increment carry register by one

Decrement Multiplier by one

Is multiplier NO

Zero

YES

Store the result in desired location

Stop

Page 14: mpmc newmanual

PROGRAM :

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START 4100H LXI H,4200H Load the HL reg pair with the

address 4200H

4103H MVI C,00H Clear C reg

4105H MOV A,M Move the Multiplicand to the

accumulator.

4106H INX H Increment the HL reg pair.

4107H MOV B,M Move the Multiplier to B reg.

4108H DCR B Decrement B reg.

4109H MOV D,A Move the Multiplicand to D reg.

LOOP2 410AH ADD D Add the content of A reg with D

reg. content.

410BH JNC LOOP1 If CY=0, program control

jumps to label LOOP1.

410EH INR C Increment C reg.

LOOP1 410FH DCR B Decrement B reg.

4110H JNC LOOP2 If B is not equal to zero,

program control goes to

LOOP2; otherwise do next step

4113H INX H Increment the HL reg. pair.

4114H MOV M,A Store the least significant byte

of the product to the memory

location pointed by HL pair.

4115H INX H Increment the HL reg.

4116H MOV M,C Store the most significant byte

of the product to the memory

location pointed by HL pair.

4117H HLT Stop the Process

RESULT:

Thus the Assembly Language Program for the multiplication of two 8-bit data had

been written and executed & the results were stored in desired memory locations.

Page 15: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. What does memory-mapping mean?

2. What is interrupt 1/0?

3. Why EPROM is mapped at the beginning of memory space in 8085

system?

4. What is the need for system clock and how it is generated in 8085?

5. What is the need for Port?

Page 16: mpmc newmanual

Experiment No: Date:

DIVISION OF TWO 8-BIT NUMBERS

AIM:

To write an Assembly Language Program for dividing two 8-bit numbers and store

the result in memory locations 4502 and 4503.

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with keyboard

(ii) Power cable.

ALGORITHM:

Step 1: Initialize the HL register pair with address 4500H.

Step 2: Clear the C register.

Step 3: Get dividend in accumulator & get divisor in B register.

Step 4: Compare dividend and divisor.

Step 5: If carry occurs, go to step 8. Otherwise go to next step.

Step 6: Subtract divisor from dividend and increment C register.

Step 7: Go to step 4.

Step 8: Store the remainder in 4503H.

Step 9: store the quotient in 4502H.

Step 10: Stop the Process.

Page 17: mpmc newmanual

FLOWCHART

Start

Get dividend & divisor, Initialize C reg. for Quotient

Is

Dividend NO

>

Divisor

YES

Subtract Divisor from Dividend

Increment Quotient by one

Store the Quotient and Store the dividend as remainder

Stop

Page 18: mpmc newmanual

PROGRAM :

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START 4100H LXI H,4500H Load the HL reg pair with the

address 4500H.

4103H MVI C,00H Clear C reg.

4105H MOV A,M Move the Dividend to the

accumulator.

4106H INX H Increment the HL reg pair.

4107H MOV B,M Move the Divisor to B reg.

REPEAT 4108H CMP B Compare B reg.

4109H JC SKIP If carry=1, jump to label

SKIP.

410CH SUB B Subtract the divisor from

dividend.

410DH INR C Increment C reg.

410EH JMP

REPEAT Jump to label REPEAT.

SKIP 4111H STA 4503H Store the remainder.

4114H MOV A,C Move the Quotient to

Accumulator.

4115H STA 4502H Store the Quotient.

4118H HLT Stop the Process

RESULT:

Thus the Assembly Language Program for the Division of two 8-bit data had been

written and executed & the results were stored in desired memory locations.

Page 19: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. What is a port?

2. Give some examples of port devices used in 8085 microprocessor based

system?

3. Write a short note on INTEL 8255

4. What is the drawback in memory mapped I/0?

5. How DMA is initiated?

Page 20: mpmc newmanual

Experiment No: Date:

LARGEST NUMBER IN GIVEN ARRAY

AIM:

To write an Assembly Language Program to find the largest number in the given

Array.

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with keyboard.

(ii) Power cable.

ALGORITHM:

Step 1: Initialize the HL register pair with the address 4700H.

Step 2: Get the first Data in accumulator.

Step 3: Get the count (i.e., Length of the array) in B register.

Step 4: Compare the next data from the memory address pointed by HL pair

to the accumulator.

Step 5: Check the Carry Flag. If the CF is reset go to step 7 otherwise go to

next step.

Step 6: Move the data from the memory address pointed by HL pair to the

accumulator.

Step 7: Decrement the count (content of B register)

Step 8: If the content of B register is not equal to zero, go to step 4,

otherwise go to next step.

Step 9: Store the content of accumulator in the address 5000H.

Step 10: Stop the Process.

Page 21: mpmc newmanual

FLOWCHART

Start

Get the length of the array as the count

Move the first data to Accumulator

Increment the memory pointer

Compare the second data with content of Accumulator

Is A content YES

Large?

NO

Move M to A

Decrement B reg

NO Is

Count=0?

YES

Store the Content of accumulator as largest number

Stop

Page 22: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 4100 LXI H, 4700H Initialize the memory

pointer with the address

4700H 4103 MOV B,M Get the length of the

array in B reg. 4104 INX H Increment the HL reg.

pair to point the next

memory location. 4105 MOV A,M Get the first data in

Accumulator. 4106 DCR B Decrement B reg.

content by one LOOP 4107 INX H Increment the HL reg.

pair to point the next

memory location. 4108 CMP M Compare the data in

accumulator with data in

memory. 410B JNC SKIP If CF is reset, the

program control goes to

label SKIP. 410C MOV A,M Move the data from

memory to accumulator. SKIP 410D DCR B Decrement B reg.

content

411E JNZ LOOP If ZF is reset go to

LOOP.

4111 STA 5000H Store the largest number

in 5000H

4114 HLT Stop the process

RESULT:

Thus the Assembly Language Program to find the largest of the given data had been

written and executed & the result was stored in the desired memory location

Page 23: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. What is Instruction cycle?

2. What is fetch and execute cycle?

3. What is Block and Demand transfer mode DMA?

4. What is the need for timing diagram?

5. How many machine cycles constitute one instruction cycle in 8085?

Page 24: mpmc newmanual

Experiment No: Date:

SMALLEST NUMBER IN GIVEN ARRAY

AIM:

To write an Assembly Language Program to find the smallest number in the given

Array.

APPARATUS REQUIRED:

((i) 8085 Microprocessor kit with keyboard.

(ii) Power cable.

ALGORITHM:

Step 1: Initialize the HL register pair with the address 4700H.

Step 2: Get the first Data in accumulator.

Step 3: Get the count (i.e., Length of the array) in B register.

Step 4: Compare the next data from the memory address pointed by HL pair

to the accumulator.

Step 5: Check the Carry Flag. If the CF is set, go to step 7 otherwise go to

next step.

Step 6: Move the data from the memory address pointed by HL pair to the

accumulator.

Step 7: Decrement the count (content of B register)

Step 8: If the content of B register is not equal to zero, go to step 4, otherwise

go to next step.

Step 9: Store the content of accumulator in the address 5000H.

Step 10: Stop the Process.

Page 25: mpmc newmanual

FLOWCHART

Start

Get the length of the array as the count

Move the first data to Accumulator

Increment the memory pointer

Compare the memory with content of Accumulator

Is A content YES

Small?

NO

Move M to A

Decrement B reg.

NO Is

Count=0?

YES

Store the Content of accumulator as smallest number

Stop

Page 26: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 4100 LXI H, 4700H Initialize the memory

pointer with the address

4700H 4103 MOV B,M Get the length of the

array in B reg. 4104 INX H Increment the HL reg.

pair to point the next

memory location. 4105 MOV A,M Get the first data in

Accumulator. 4106 DCR B Decrement B reg.

content by one LOOP 4107 INX H Increment the HL reg.

pair to point the next

memory location. 4108 CMP M Compare the data in

accumulator with data in

memory. 410B JC SKIP If CF is set the program

control goes to SKIP. 410C MOV A,M Move the data from

memory to accumulator. SKIP 410D DCR B Decrement B reg.

content.

411E JNZ LOOP If ZF is reset go to

LOOP.

4111 STA 5000H Store the smallest

number in 5000H

4114 HLT Stop the process

RESULT:

Thus the Assembly Language Program to find the smallest of the given data had

been written and executed & the result was stored in the desired memory location.

OBSERVATION:

Page 27: mpmc newmanual

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. Define opcode and operand.

2. What is opcode fetch cycle?

3. What operation is performed during first T -state of every machine cycle

in 8085 ?

4. Why status signals are provided in microprocessor?

5 . How the 8085 processor differentiates a memory access and I/0

Access?

Experiment No: Date:

Page 28: mpmc newmanual

8085-ASCENDING ORDER

AIM:

To write an Assembly Language Program to arrange the given data in Ascending

Order.

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with keyboard.

(ii) Power cable.

ALGORITHM:

Step 1: Initialize the HL register pair with the address 4700H.

Step 2: Get the count 1, number of repetitions (length of array - 1) in B

register.

Step 3: Get the count 2, number of comparisons (length of array -1) in C

register.

Step 4: Save the count 2 in E register.

Step 5: Move the content of E to C register.

Step 6: Initialize the HL register pair with the address 4701H.

Step 7: Move the data from memory location pointed by HL pair to the

Accumulator.

Step 8: Compare the data from next memory location with the content of

Accumulator.

Step 9: Check CF. If carry flag is set (accumulator content is smaller than the

other number), go to step 12 otherwise do next step.

Step 10: Check ZF. If zero flag is set (accumulator content is equal to the other

number), go to step 12 otherwise do next step.

Step 11: Store the smallest number to the previous memory location & greatest

to the current memory location.

Step 12: Decrement the number of comparisons (count 2).

Step 13: If the number of comparison is not equal to zero, go to step 7,

otherwise do the next step.

Step 14: Decrement the number of repetitions (count 1).

Step 15: If the number of repetitions is not equal to zero, go to step 5,

otherwise do next step.

Step 16: Stop the Process.

Page 29: mpmc newmanual

FLOWCHART

Start

Initialize memory pointer to get N, the length of series

Initialize COUNT 1 for (N-1) repetitions

Initialize COUNT 2 for (N-1) Comparisons

Increment memory pointer and get the number from series

IS pointer < NO Interchange

(pointer+1)? Numbers

YES

Decrement COUNT 2

NO

Is COUNT 2 =

Zero?

YES

Decrement COUNT 1

NO

Is COUNT 1 =

zero?

YES

Stop

Page 30: mpmc newmanual

PROGRAM :

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START 4100 LXI H, 4700H Initialize HL reg. pair

with 4700H

4103 MOV B,M

4104 DCR B B = COUNT 1 for

(N-1)repetitions

4105 MOV C,B C = COUNT 2 for

(N-1)Comparisons

4106 MOV E,C LOOP 4107 MOV C,E

4108 LXI H, 4701H REPEAT 410B MOV A,M

410C INX H

410D CMP M Compare consecutive

numbers

411E JC SKIP

4111 JZ SKIP

4114 MOV D,M Interchange numbers if

not in order 4115 MOV M,A

4116 DCX H

4117 MOV M,D

4118 INX H SKIP 4119 DCR C Decrement count 2

411A JNZ REPEAT

411D DCR B Decrement count 1

411E JNZ LOOP

4121 HLT Stop the Process

RESULT:

Thus the Assembly Language Program to arrange the given data in ascending order

had been written and executed.

Page 31: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. When the 8085 processor checks for an interrupt?

2. What is interrupt acknowledge cycle?

3. How the interrupts are affected by system reset?

4. What is Software interrupts?

5. What is Hardware interrupt?

Page 32: mpmc newmanual

Experiment No: Date:

8085-DESCENDING ORDER

AIM:

To write an Assembly Language Program to arrange the given data in Descending

Order.

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with Keyboard.

(ii) Power cable.

ALGORITHM:

Step 1: Initialize the HL register pair with the address 4700H.

Step 2: Get the count 1, number of repetitions (length of array - 1) in B

register.

Step 3: Get the count 2, number of comparisons (length of array -1) in C

register.

Step 4: Save the count 2 in E register.

Step 5: Move the content of E to C register.

Step 6: Initialize the HL register pair with the address 4701H.

Step 7: Move the data from memory location pointed by HL pair to the

Accumulator.

Step 8: Compare the data from next memory location with the content of

Accumulator.

Step 9: Check CF. If carry flag is reset (accumulator content is larger than the

other number), go to step 12 otherwise do next step.

Step 10: Check ZF. If zero flag is set (accumulator content is equal to the other

number), go to step 12 otherwise do next step.

Step 11: Store the largest number to the previous memory location & smallest to

the current memory location.

Step 12: Decrement the number of comparisons (count 2).

Step 13: If the number of comparison is not equal to zero, go to step 7, otherwise

do the next step.

Step 14: Decrement the number of repetitions (count 1).

Step 15: If the number of repetitions is not equal to zero, go to step 5, otherwise

do next step.

Step 16: Stop the Process.

Page 33: mpmc newmanual

FLOWCHART

Start

Initialize memory pointer to get N, the length of series

Initialize COUNT 1 for (N-1) repetitions

Initialize COUNT 2 for (N-1) Comparisons

Increment memory pointer and get the number from series

IS pointer > NO Interchange

(pointer+1)? Numbers

YES

Decrement COUNT 2

NO

Is COUNT 2

= zero?

YES

Decrement COUNT 2

NO

Is COUNT 1

= zero?

YES

Stop

Page 34: mpmc newmanual

PROGRAM :

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START 4100 LXI H, 4700H

4103 MOV B,M

4104 DCR B B = COUNT 1 for

(N-1)repetitions

4105 MOV C,B C = COUNT 2 for

(N-1)Comparisons

4106 MOV E,C LOOP 4107 MOV C,E

4108 LXI H, 4701H REPEAT 410B MOV A,M

410C INX H

410D CMP M Compare consecutive

numbers

411E JNC SKIP

4111 JZ SKIP

4114 MOV D,M Interchange numbers if

not in order 4115 MOV M,A

4116 DCX H

4117 MOV M,D

4118 INX H SKIP 4119 DCR C Decrement count 2

411A JNZ REPEAT

411D DCR B Decrement count 1

411E JNZ LOOP

4121 HLT Stop the Process

RESULT:

Thus the Assembly Language Program to arrange the given data in ascending order

had been written and executed.

Page 35: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. What is the difference between Hardware and Software interrupt?

2. What is Vectored and Non- Vectored interrupt?

3. List the Software and Hardware interrupts of 8085?

4. Whether HOLD has higher priority than TRAP or not?

5. What is masking and why it is required?

Page 36: mpmc newmanual

Experiment No: Date:

BLOCK OF DATA TRANSFER

AIM:

To write an Assembly Language Program to transfer the block of data starting from

memory location 4700H to the memory location 4800H. The total number of data (length of

block) is stored at 46FFH.

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with keyboard

(ii) Power cord.

ALGORITHM:

Step 1: Initialize the HL register pair with the address 46FFH.

Step 2: Move the total number of data to the C register.

Step 3: Initialize the DE register pair with the address 4800H.

Step 4: Get byte from source memory block.

Step 5: Store the first data to the destination address.

Step 6: Increment the source block pointer.

Step 7: Increment the destination block pointer.

Step 8: Decrement the C register.

Step 9: If ZF=0, go to step 4.otherwise go to next step.

Step 10: Stop the Process.

Page 37: mpmc newmanual

FLOWCHART

Start

Initialize HL reg. pair as a source

Load the total number of input data In C reg.

Get the Data from source Block to Accumulator

Store data to destination block

Increment the source & destination block pointer

Decrement C reg.

NO Is

ZF=1?

YES

Stop

Page 38: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START 4100H LXI H,46FFH Initialize the source pointer

with the address 4200H.

4103H MVI C,M Get count of total number of

data bytes in C reg.

4104H INX H Point to first source block

byte.

4105H LXI D,4800H Initialize the destination

pointer with the address

4200H.

REPEAT 4108H MOV A,M Get the data byte from source

block.

4109H STAX D Store the data byte to the

destination block.

410AH INX H Increment source block

pointer.

410BH INX D Increment destination block

pointer.

410CH DCR C Decrement C register.

410DH JNZ

REPEAT If ZF=0, program control

jump to label REPEAT.

4110H HLT Stop the Process

RESULT:

Thus the assembly language program to transfer the block of data from memory

location 4700H to 4800H had been written and verified

Page 39: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. When the 8085 processor accept hardware interrupt?

2. When the 8085 processor will disable the interrupt system?

3. What is the function performed by Dl instruction?

4. What is the function performed by El instruction?

5. How the vector address is generated for the INTR interrupt of 8085?

Page 40: mpmc newmanual

Experiment No:

Date:

DECIMAL TO HEXADECIMAL CONVERSION

AIM:

To write an Assembly Language Program to convert a Decimal number to a

Hexadecimal number. The Decimal data is stored in 4200H and Hexadecimal data is store in

4250H.

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with keyboard.

(ii) Power cable.

ALGORITHM:

Step 1: Get the Decimal data in A reg. and save in E reg.

Step 2: Mask the lower nibble of the decimal data in A reg.

Step 3: Rotate the upper nibble to the lower position.

Step 4: Clear the Accumulator.

Step 5: Move the 0AH to C reg.

Step 6: Add B reg. content to the A reg. Content.

Step 7: Decrement the C reg. If ZF=0 go to step 6. I f ZF=1 go to next step.

Step 8: Save the product in B reg.

Step 9: Get the decimal in A reg. from E reg. and mask the upper

nibble(units).

Step 10: Add the units (A reg.) to product (B reg.).

Step 11: Stop the Process.

Page 41: mpmc newmanual

FLOWCHART: Start

Get the Decimal data in A reg. and save it in E reg.

Mask the lower nibble of the Decimal data in A reg.

Rotate the content of A reg. four times right & save it in B reg.

Clear A reg. and move 0AH to C reg.

ADD the content of B reg. to A reg.

Decrement C reg.

NO Check

if ZF=1?

YES

Move the content of A reg. to B reg.

Move the decimal data from E reg. to A reg. and mask the upper nibble

ADD the content of B reg. to A reg.

Store the Hexadecimal value from A reg. to memory

Stop

Page 42: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START 4100 LDA 4200H Get the data in A reg.

4103 MOV E,A Save in E reg.

4104 ANI F0H Mask the lower nibble

4106 RLC Rotate the upper nibble to

lower Nibble position save

in B reg. 4107 RLC 4108 RLC

4109 RLC 410A MOV B,A

410B XRA A Clear accumulator

410C MVI C,0AH Get the product of units digit

multiplied by 0AH in A reg. REPEAT 410E ADD B

410F DCR C

4110 JNZ REPEAT

4113 MOV B,A Save the product in B reg.

4114 MOVA,E Get the Decimal data in A

reg.

4115 ANI 0FH Mask the upper nibble

4117 ADD B Get the sum of units digit

and product in B reg. 4118 STA 4250H Store the Hexadecimal value

in memory

411B HLT Stop the Process

RESULT:

Thus the Assembly Language Program for Decimal to Hexadecimal conversion had

been written and executed & the results were stored in desired memory location.

OBSERVATION:

Page 43: mpmc newmanual

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. How clock signals are generated in 8085 and what is the frequency of the

internal clock?

2. What happens to the 8085 processor when it is resetted?

3. What are the operations performed by ALU of 8085?

4. What is a flag?

5. List the flags of 8085

Page 44: mpmc newmanual

Experiment No:

Date:

ADDITION OF TWO 16 BIT NUMBERS

AIM:

To write an Assembly Language Program to add two 16 bit numbers & store the

result

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with keyboard.

(ii) Power cable.

ALGORITHM:

Step 1: Get the first data in DE pair

Step 2: Get the second data in HL pair

Step 3: Add the data in DE & HL pair

Step 4: Store the result in 4204.

Step 5: Stop the Process.

Page 45: mpmc newmanual

Stop

FLOWCHART: Start

Get the 1st data in DE register pair

Get the 2nd data in HLregister pair

Add DE & HL pair contents

Store the result in 4204 &4205

Page 46: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START 4100H LHLD 4200H Get first I6-bit number

4103H XCHG Save first I6-bit number in

DE

4104H LHLD 4202H Get second I6-bit number in

HL

4105H DAD D Add DE and HL

4106H SHLD 4204H Store I6-bit result in memory

locations 4004H and 4005H.

4109H HLT Stop the program

RESULT:

Thus the Assembly Language Program for 16 bit addition had been written and

executed & the results were stored in desired memory location.

Page 47: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. Which interrupt has highest priority in 8085? What is the priority of other

interrupts?

2. What is an ALE?

3. Explain the function of IO/M in 8085.

4. Where is the READY signal used?

5. What is HOLD and HLDA and how it is used?

Page 48: mpmc newmanual

Experiment No: Date:

SUBTRACTION OF TWO 16 BIT NUMBERS

AIM:

To write an Assembly Language Program to subtract two 16 bit numbers & store the

result

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with keyboard.

(ii) Power cable.

ALGORITHM:

Step 1: Get the first data in DE pair

Step 2: Get the second data in HL pair

Step 3: Subtract the lower order byte of the 1st & 2

nd number

Step 4: Subtract the higher order byte of the 1st & 2

nd number

Step 5: Store the result in . in memory locations 4204H and 4205H.

Step6: Stop the process

Page 49: mpmc newmanual

Stop

FLOWCHART: Start

Get the 1st

& 2nd

data in DE & HL register pair

Subtract the lower order byte of the 1st & 2

nd number

Subtract the higher order byte of the 1st & 2

nd number

Store the result in 4204& 4205

Page 50: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START 4100H LHLD 4200H Get the 1st data in HL reg

pair

4103H XCHG Save in DE reg. pair

4104H LHLD 4202H Get second 16-bit number in

HL

4107H MOV A,E Get lower byte of the first

number

4108H SUB L Subtract lower byte of the

second number

410BH MOV L,A Store the result in L register

.

410CH MOV A,D Get higher byte of the first

number

410DH SBB H Subtract higher byte of

second number with borrow

410EH MOV H,A Store l6-bit result in

memory locations 4204H

and 4205H.

410FH SHLD 4204H Store l6-bit result in memory

locations 4004H and 4005H

4112H HLT Stop the Process

RESULT:

Thus the Assembly Language Program for 16 bit subtraction had been written and

executed & the results were stored in desired memory location.

Page 51: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. What is Polling?

2. What are the different types of Polling?

3. What is the need for interrupt controller?

4. List some of the features of INTEL 8259 (Programmable

Interrupt Controller

5. What is a programmable peripheral device ?

Page 52: mpmc newmanual

Experiment No: Date:

MULTIPLICATION OF TWO 16 BIT NUMBERS

AIM:

To write an Assembly Language Program to multiply two 16 bit numbers & store the

result

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with keyboard.

(ii) Power cable.

ALGORITHM:

Step 1: Get the first data in HL pair

Step 2: Exchange the data with DE pair

Step 3:Get the second data in HL pair

Step 4: Copy the data in Stack Pointer(SP)

Step 5: DAD with SP

Step6: If there is carry, goto step7, else goto step8

Step7: Increment BC pair

Step8: Decrement DE pair

Step9: Move E-reg content to accumulator

Step10: OR DE pair content with accumulator. If the result is not zero, goto step5

Step10: Move BC register pair content to HL pair

Step11: Store the accumulator content

Step12: Stop the process

Page 53: mpmc newmanual

Stop

FLOWCHART:

Start

Load the HL pair with 1st data. Exchange the data with DE pair

Get the second data in HL pair. Exchange HL pair content with DE pair

Perform double addition

Is NO

there carry?

YES

Increment BC-reg content by 1

Decrement DE register pair by one

Move E-reg content to accumulator

DE reg pair. . OR accumulator content

With DE pair content

NO

Is the result

zero?

YES

Store the result

Page 54: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START: 4100H LHLD 4500H Load the HL pair with 1st

data

4103H SPHL Exchange the data with DE

pair 4104H LHLD 4502 Get the second data in HL

pair

4107H XCHG Exchange HL pair content

with DE pair

4108H LXI H, 0000H

Initialise HL pair & DE

pair with00H

410BH LXI B, 0000H L2: 410EH DAD SP Perform double addition 410FH JNC L1 If there is no carry, goto L1 4112H INX B Increment the content of

BC reg pair by one L1: 4113H DCX D Decrement the content of

DE reg pair by one

4114H MOV A,E Move E-reg content to

accumulator

4115H ORA D OR accumulator content

with DE reg pair

4116H JNZ L2 Jump to L2 if not zero

4119H SHLD 4504H Store HL pair content in

4504H

411CH MOV A,C Move C-reg content to

accumulator

411DH STA 4506H Store HL pair content in

4506H

4120H MOV A,B Move B-reg content to

accumulator

4121H STA 4507H Store accumulator content

in 4507H

4124H HLT Stop the process

RESULT:

Thus the Assembly Language Program for 16 bit multiplication had been written and

executed & the results were stored in desired memory location.

Page 55: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1.

Page 56: mpmc newmanual

Experiment No: Date:

DIVISION OF TWO 16 BIT NUMBERS

AIM:

To write an Assembly Language Program to divide two 16 bit numbers & store the

quotient & remainder

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with keyboard.

(ii) Power cable.

ALGORITHM:

Step 1: Get the first data in DE pair

Step 2: Get the second data in HL pair

Step 3: Subtract the lower order byte of the 1st & 2

nd number

Step 4: Subtract the higher order byte of the 1st & 2

nd number

Step 5: Store the result in . in memory locations 4204H and 4205H.

Step6: Stop the process

Page 57: mpmc newmanual

Stop

FLOWCHART:

Start

Dividend (2200H) & (2201H) , Divisor(2300H), Count=8, Quotient =0

Dividend = Dividend*2, Quotient = Quotient*2

YES

Is divisor

<= dividend Dividend =

? Dividend- Divisor

NO

Count = Count-1

NO Is count

= 0?

YES

Store the quotient & remainder

Page 58: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START: 4100H MVI E, 00H Initialise Quotient = 0

4102H LHLD 4200H Get dividend

4105H LDA 4204H Get divisor 4108H MOV B, A Store divisor

4109H MVI C, 08 Initialise Count = 8

NEXT: 410BH DAD H Dividend = Dividend x 2

410CH MOV A, E

410DH RLC

410EH MOV E,A Quotient = Quotient x 2

410FH MOV A,H

4110H SUB B Is most significant byte of

Dividend > divisor 4111H JC SKIP No, go to Next step

4114H MOV H,A Subtract divisor

4115H INR E Quotient = Quotient + 1

SKIP: 4116H DCR C Count = Count - 1

4117H JNZ NEXT If count =0 repeat

411AH MOV A, E

411BH STA 4301H Store Quotient

411EH MOV A,H

411FH STA 4303H Store Remainder

4122H HLT Stop the process

RESULT:

Thus the Assembly Language Program for 16 bit division had been written and

executed & the results were stored in desired memory location.

Page 59: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. What is synchronous data transfer scheme?

2. What is asynchronous data transfer scheme?

3. What are the operating modes of 8212?

4. Explain the working of a handshake output port

5. What are the internal devices of 8255 ?

Page 60: mpmc newmanual

Experiment No:

Date:

SQUARE ROOT OF 8 BIT NUMBER

AIM:

To write an Assembly Language Program to find square root of a 8 bit number using

8085

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with keyboard.

(ii) Power cable.

ALGORITHM:

Step 1: Move 01H to both C-reg & E-reg

Step 2: Load the accumulator with the content of 4200H

Step 3: Subtract accumulator content & C-reg content

Step 4: If accumulator content is zero, goto step7, else goto step5

Step 5: Increment C-reg content by two

Step6: Increment E-reg content by one & return to label

Step7: Move E- reg content to accumulator

Step8: Store the accumulator value in 4201H

Step9: Stop the process

Page 61: mpmc newmanual

FLOWCHART:

Start

Move 01H to both C-reg & E-reg. Load the accumulator

with the content of 4200H

: Subtract accumulator content & C-reg content

Is

Accumulator

content YES

zero?

NO

Increment C-reg content by two

Increment E-reg content by one &

return to label

Move E- reg content to accumulator

Store accumulator value in 4201H

Stop

Page 62: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START: 4100H MVI C,01 Move 01 to C- reg

4102H MVI E,01 Move 01 to E- reg

4104H LDA 4200H Load the accumulator with

the content of 4200 LABEL: 4107H SUB C Subtract accumulator content

& C-reg content

4108H JZ LABEL1 If accumulator content is

zero, goto label1

410BH INR C Increment C-reg content by

two 410CH INR C

410DH INR E Increment E-reg content by

one

410EH JMP LABEL Return to label LABEL1: 4111H MOV A,E Move E- reg content to

accumulator

4112H STA 4201H Store the accumulator value

in 4201 4115H HLT Stop the process

RESULT:

Thus the Assembly Language Program for square root of a 8 bit number had been

written and executed & the results were stored in desired memory location.

Page 63: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. What is baud rate?

2. What is USART?

3. What are the control words of 8251A and what are its functions ?

4. Give some examples of input devices to microprocessor-based system

5. What are the tasks involved in keyboard interface?

Page 64: mpmc newmanual

Experiment No: Date:

BCD TO HEX CONVERSION

AIM:

To write an Assembly Language Program to convert a BCD number to a hexadecimal

number using 8085

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with keyboard.

(ii) Power cable.

ALGORITHM

Step 1: Initialize memory pointer with 4300H

Step 2 Get the MSB & multiply it by 10 using repeated addition

Step 3: Add the LSB to the obtained result

Step4: Store the hexadecimal value in 4201H

Step5: Stop the process

Page 65: mpmc newmanual

Stop

FLOWCHART

Start

Initialize memory pointer with 4300H

Get the MSB & multiply it by 10 using repeated addition

Add the LSB to the obtained result

Store the hexadecimal result in the memory location

Page 66: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START: 4100H LXI H,4300H

4103H MOV A,M Initialize memory pointer

4104H ADD A MSD *2 4105H MOV B,A Store MSB *2

4106H ADD A MSB *4

4107H ADD A MSB *8

4108H ADD B MSB *10

4109H INX H Point to LSB

410AH ADD M Add to form hex 410BH INX H

410CH MOV M,A Store the result 410DH HLT Stop the process

RESULT:

Thus the Assembly Language Program to convert BCD number to hexadecimal. had

been written and executed & the results were stored in desired memory location.

Page 67: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. How a keyboard matrix is formed in keyboard interface using 8279?

2. What is scanning in keyboard and what is scan time?

3. What are the internal devices of a typical DAC?

4. What is settling or conversion time in DAC?

5. What are the different types of ADC?

Page 68: mpmc newmanual

Experiment No: Date:

HEX TO BCD CONVERSION

AIM:

To write an Assembly Language Program to convert a hexadecimal number to BCD

using 8085

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with keyboard.

(ii) Power cable.

ALGORITHM

Step 1: Initialize memory pointer with 4300H

Step 2 Get the hexadecimal number in C-reg

Step 3: Perform repeated addition for C number of times

Step4: Adjust for BCD in each step

Step5: Store the BCD number in the memory location

Step6: Stop the process

Page 69: mpmc newmanual

Stop

FLOWCHART

Start

Initialize memory pointer with 4300H

Get the hexadecimal number in C-reg

Adjust for BCD in each step & Perform repeated addition for C number of

times

Store the BCD number in the memory location

Page 70: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START: 4100H LXI H,4300H

4103H MOV A,M Initialize memory pointer

4104H ADD A MSD *2 4105H MOV B,A Store MSB *2

4106H ADD A MSB *4

4107H ADD A MSB *8

4108H ADD B MSB *10

4109H INX H Point to LSB

410AH ADD M Add to form hex 410BH INX H

410CH MOV M,A Store the result 410DH HLT Stop the process

RESULT:

Thus the Assembly Language Program to convert hexadecimal number to BCD.

had been written and executed & the results were stored in desired memory location.

OBSERVATION:

Page 71: mpmc newmanual

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. Define stack

2. What is program counter? How is it useful in program execution?

3. How the microprocessor is synchronized with peripherals?

4. What is a minimum system and how it is formed in 8085?

5. Define bit, byte and word.

Page 72: mpmc newmanual

Experiment No: Date:

FACTORIAL OF A GIVEN NUMBER

AIM:

To write an Assembly Language Program to find factorial of a given

hexadecimal number

APPARATUS REQUIRED:

(i) 8085 Microprocessor kit with keyboard.

(ii) Power cable.

ALGORITHM

Step 1: Initialize memory pointer with 4200H

Step2: Get the multiplicand in E-reg & move it to the next memory location.

Decrement E-reg by 1

Step3: Move the multiplicand to accumulator

Step 4: Get the multiplier in B reg& move to the multiplicand to D-reg.

Clear accumulator contents

Step5: Add the contents of accumulator & D-reg.

Step6: Decrement B-reg by 1& if B-reg content is zero, goto step7, else

goto step5

Step7: Move accumulator contents to memory

Step8: Decrement E reg & move E-reg contents to C-reg & : Decrement C

reg

Step9: If C-reg content is zero goto step10, else goto step3

Step10: Stop the process

Page 73: mpmc newmanual

FLOWCHART

Start

Initialise the HL pair with the address 4200H

Get the multiplicand in E-reg & move it to the next memory location.

Decrement E-reg by 1

Move the multiplicand to accumulator.

Get the multiplier in Breg. Move to the multiplicand D-reg& clear

accumulator contents

Add the contents of accumulator & D-reg.

.

Decrement B-reg by one

Is B-reg

NO Content zero?

YES

Move accumulator toMemory

Decrement E reg & move E-reg contents

To C-reg

Decrement C-reg

.

Is C- reg NO

=0 ?

YES

Stop

Page 74: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START: 4300H LXI H,4200H Initialize memory pointer

with 4200H

4303H MOV E,M Get the multiplicand in E-reg

& move it to the next

memory location.

Decrement E-reg by 1

4304H INX H 4305H MOV M,E

4306H DCR E LOOP1: 4307H MOV A,M Move the multiplicand to

accumulator

4308H MOV B,E Get the multiplier in B reg&

move to the multiplicand to

D-reg Clear accumulator

contents

4309H MOV D,A

430AH XRA A

LOOP2: 430BH ADD D Add the contents of

accumulator & D-reg.

430CH DCR B Decrement B-reg by 1 430DH JNZ LOOP2 Check whether B- reg

content is zero 4310H MOV M,A Move accumulator contents

to memory 4311H DCR E Decrement E-reg by 1

move E-reg contents to C-

reg

4312H MOV C,E

4313H DCR C Decrement C reg by 1 4314H JNZ LOOP1 Check whether C- reg

content is zero 4317H HLT Stop the process

RESULT:

Thus the Assembly Language Program to convert to find factorial of a given

hexadecimal number had been written and executed & the results were stored

in desired memory location.

Page 75: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. What is PSW?

2. What is the purpose of ALE?

3. What is the need for interrupt controller?

4. Give some examples of input devices to microprocessor-based system

5 Give some examples of port devices used in 8085 microprocessor

based system?

Page 76: mpmc newmanual

Experiment No: Date:

8086-ADDITION OF TWO 16-BIT NUMBERS

AIM:

To write an assembly language program to add two 16 bit numbers and store the sum

in the memory location 1200H and carry in 1202H.

APPARATUS REQUIRED:

(i) 8086 Microprocessor kit with keyboard.

(ii) Power Cable.

ALGORITHM:

Step 1: Initialize the BL reg. with 00H to account for carry.

Step 2: Move one of the data to AX reg.

Step 3: Move next data to CX reg.

Step 4: Clear Carry Flag.

Step 5: ADD the CX reg. content with the AX reg. Jump to step 7 if no carry

occurs. Otherwise go to next step.

Step 6: Increment BL reg.

Step 7: Move the sum to 1200H.

Step 8: Move the carry to 1202H.

Step 9: Stop the Process

Page 77: mpmc newmanual

FLOWCHART:

Start

Initialize BL reg. with 00H

Move Data into AX and CX reg.

Clear Carry Flag

Add CX and AX reg.

Is Carry NO

Set?

` YES

Increment BL reg

Store Sum and Carry to Memory

Stop

Page 78: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 1000H MOV BL,00H Move 00H to BL reg. to

account for carry.

1003H MOV

AX,FFFFH Move the data FFFFH to AX

reg.

1007H MOV CX,001FH Move the data 001FH to CX

reg.

100BH CLC Clear Carry Flag.

100CH ADD AX, CX Add the content of CX to AX.

100EH JNC LOOP If no carry occurs, jump to

LOOP.

1010H INC BL Increment BL reg.

LOOP 1012H MOV[1200H],AX Move the AX content (sum)to

1200H & 1201H.

1016H MOV[1202H],BL Move the BL content to

1202H.

101AH HLT Stop the Process.

RESULT:

Thus the Assembly Language Program for Addition of two 16-bit numbers had been

written and executed & the results were stored in desired memory locations.

Page 79: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. What is the name given to the register combination DX:AX?

2. What are the modes in which 8086 can operate?

3. What is the data and address size in 8086?

4. Explain the function of M/IO in 8086.

5. Write the flags of 8086

Page 80: mpmc newmanual

Experiment No: Date:

8086-SUBTRACTION OF TWO 16-BIT NUMBERS

AIM:

To write an assembly language program to Subtract two 16 bit numbers and store the

difference in the memory location 1200H and borrow in 1202H.

APPARATUS REQUIRED:

(i) 8086 Microprocessor kit with keyboard.

(ii) Power Cable.

ALGORITHM:

Step 1: Initialize the BL reg with 00H to account for borrow.

Step 2: Move Minuend to AX reg.

Step 3: Move Subtrahend to CX reg.

Step 4: Clear Carry Flag.

Step 5: Subtract the CX reg. content from the AX reg. Jump to step 7 if no

carry occurs. Otherwise go to next step.

Step 6: Increment BL reg.

Step 7: Move the difference to 1200H.

Step 8: Move the borrow to 1202H.

Step 9: Stop the Process

Page 81: mpmc newmanual

FLOWCHART:

Start

Initialize BL reg. with 00H

Move Data into AX and CX reg.

Clear Carry Flag

Subtract CX from AX reg.

NO

Is Carry

Set?

YES

Increment BL reg

Store Difference and Borrow in memory

Stop

Page 82: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 1000H MOV BL,00H Move 00H to BL reg. to

account for carry.

1003H MOV

AX,FFFFH Move the data FFFFH to AX

reg.

1007H MOV

CX,OO1FH Move the data 001FH to CX

reg.

100BH CLC Clear Carry Flag.

100CH SUB AX, CX Subtract the content of CX

from AX.

100EH JNC LOOP If no carry occurs, jump to

LOOP.

1010H INC BL Increment BL reg.

LOOP 1012H MOV[1200H],AX Move the AX content

(difference) to 1200H.

1016H MOV[1202H],BL Move the BL content to

1202H.

101AH HLT Stop the Process.

RESULT:

Thus the Assembly Language Program for Subtraction of two 16-bit numbers had

been written and executed & the results were stored in desired memory locations.

Page 83: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. What are the interrupts of 8086?

2. How clock signal is generated in 8086?

3. What is the maximum internal clock frequency of 8086?

4. Write the special functions carried by the general purpose

registers of 8086

5. What is pipelined architecture?

Page 84: mpmc newmanual

Experiment No: Date:

8086-MULTIPLICATION OF TWO 16-BIT NUMBERS

AIM:

To write an assembly language program for Multiplication of two 16 bit numbers

using 8086 instruction set.

APPARATUS REQUIRED:

(i) 8086 Microprocessor kit with keyboard.

(ii) Power Cable.

ALGORITHM:

Step 1: Initialize the BL reg. with 00H to account for carry.

Step 2: Move Multiplicand to AX reg.

Step 3: Move Multiplier to CX reg.

Step 4: Clear Carry Flag.

Step 5: Multiply the CX reg. with the AX reg. Jump to step 7 if no carry occurs.

Otherwise go to next step.

Step 6: Increment BL reg.

Step 7: Move the content of AX & BL to the specified memory locations.

Step 9: Stop the Process

Page 85: mpmc newmanual

FLOWCHART:

Start

Initialize BL reg. with 00H

Move Data into AX and CX reg.

Clear Carry Flag

Multiply CX and AX reg. content

Is Carry NO

Set?

YES

Increment BL reg

Store the result in memory location

Stop

Page 86: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 1000H MOV BL,00H Move 00H to BL reg. to

account for carry.

1003H MOV AX,11A2H Move the data 11A2H to AX

reg.

1007H MOV CX,11B3H Move the data 11B3H to CX

reg.

100BH MUL CX Multiply the content of CX to

AX reg.

100DH JNC LOOP If no carry occurs, jump to

LOOP.

100FH INC BL Increment BL reg.

LOOP 1011H MOV[1200H],AX Move the AX content to

1200H & 1201H.

1015H MOV[1202],DX Move the DX content to

1202H & 1203H.

1019H MOV[1204H],BL Move the BL content to

1204H.

101DH HLT Stop the Process.

RESULT:

Thus the Assembly Language Program for Multiplication of two 16-bit numbers had

been written and executed & the results were stored in desired memory locations

OBSERVATION:

Page 87: mpmc newmanual

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. List the segment registers of 8086

2. Illustrate the use of LEA, LDS, and LES instruction

3. What instructions are needed to add AL, 3L and DL together, and

Place the result in CL?

4. What is purpose served by CX register?

5. Which are pointers present in this 8086?

Page 88: mpmc newmanual

Experiment No: Date:

8086-DIVISION OF 32 BIT NUMBER BY 16-BIT NUMBER

AIM:

To write an assembly language program for Division of 32 bit number by 16 bit

number using 8086 microprocessor kit.

APPARATUS REQUIRED:

(i) 8086 Microprocessor kit with keyboard.

(ii) Power Cable.

ALGORITHM:

Step 1: Move the lower order byte of dividend to AX reg. and higher order byte of

dividend to DX reg.

Step 2: Move Divisor to CX reg.

Step 3: Divide the content of AX&DX by CX reg.

Step 4: Move the content of AX & DX in the specified memory locations.

Step 5: Stop the Process.

Page 89: mpmc newmanual

FLOWCHART:

Start

Move the Dividend into AX and DX reg

Move the Divisor Value to CX reg

Divide DX & AX by CX contents

Store the Quotient value in desired memory

Store the remainder in desired memory

Stop

Page 90: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 1000H MOV AX,FFFFH Move the data FFFFH to

AX reg

1004H MOV DX, 0012H Move the data 0012H to DX

reg

1008H MOV CX,01A1H Move the Divisor 01A1 to

CX reg

100CH DIV CX Divide the content of

AX&DX BY CX

100EH MOV[1200H],AX Move the AX content to

1200H.

1012H MOV[1202H],DX Move the DX content to

1202H.

1016H HLT Stop the Process

RESULT:

Thus the Assembly Language Program for the Division of 32 –bit number by 16-bit

number had been written and executed & the results were stored in desired memory location

Page 91: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. How is register AL is used during execution of XLAT?

2. What is the use of PUSH and POP instruction?

3. What is the purpose of XCHG instruction?

4. What do square brackets means when they appear in an operand?

5. Write a routine to swap nibbles in AL.

Page 92: mpmc newmanual

Experiment No: Date:

8086 -REVERSAL OF A STRING

AIM:

To write an assembly language program to reverse a given string using 8086

microprocessor kit

APPARATUS REQUIRED:

(i) 8086 Microprocessor kit with keyboard.

(ii) Power Cable.

ALGORITHM:

Step 1: AX is initialized with data & AX is moved into DS

Step 2: Initialize CX to 5

Step 3: Load the effective address in SI & DI. Add SI with 04

Step 4: Move SI to AL

Step 5: Decrement SI & Increment DI. Repeat this until an interrupt is raised

. Step 6: Stop the Process.

Page 93: mpmc newmanual

FLOWCHART:

Start

AX is initialized with data & AX is moved

into DS

CX is initialized to 5

Load the effective address in SI & DI. Add

SI with 04

SI is moved to AL

Decrement SI & Increment DI

Repeat this until an interrupt is raised

Stop

Page 94: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START: MOV AX ,@

DATA AX is initialized with

data

MOV DS, AX AX is moved into DS

MOV CX, 0005H CX is initialized to 5

LEA SI, A1 Load the effective

address in SI & DI LEA DI, A2 ADD SI, 0004

Add SI content with 04

AGAIN: MOV AL,[SI]

SI is moved to AL

MOV [DI],AL AL is moved into DI

DEC SI

Decrement SI

INC DI

Increment DI

LOOP AGAIN

INT 3 Interrupt

END Stop the Process

RESULT:

Thus the Assembly Language Program for string reversal has been written and

executed & the results were stored in desired memory location

Page 95: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. Mention the features of 8086?

2. Explain how physical address is formed in 8086.

3. What is stack and Subroutine?

4. Difference between Microprocessor & Microcontroller

5. What is the maximum memory addressing and I/O

addresing capabilities of 8086?

Page 96: mpmc newmanual

8086 –ADDITION OF TWO 32 BIT NUMBERS

AIM:

To write an assembly language program to add two 32 bit numbers using 8086

APPARATUS REQUIRED:

(i) 8086 Microprocessor kit with keyboard.

(ii) Power Cable.

ALGORITHM:

Step 1: AX is initialized with data & AX is moved into DS

Step 2: Initialize CX to 5

Step 3: Load the effective address in SI & DI. Add SI with 04

Step 4: Move SI to AL

Step 5: Decrement SI & Increment DI. Repeat this until an interrupt is raised

. Step 6: Stop the Process.

Page 97: mpmc newmanual

FLOWCHART:

Start

AX is initialized with data & AX is moved

to DS

Data2 is moved to BX & added with Data4

Data3 is moved toCX &added with carry with data4

Data 4C is moved to AH & AL content is moved to DI

Interrupt is raised

Stop

Page 98: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START: MOV AX ,@ DATA AX is initialized

with data

MOV DS, AX AX is moved into

DS

MOV BX, Data2 Move data2 to BX

ADD BX, Data4 Data4 is added with

BX content

MOV CX,Data1 Move data1 to CX

ADC CX, Data3

Data3 is added with

CX content

MOV AH,4CH Data 4C is moved

to AH

MOV [DI],AL AL content is

moved to DI

INT 21H Interrupt

END Stop the Process

RESULT:

Thus the Assembly Language Program for 32 –bit addition has been written and

executed & the results were stored in desired memory location

Page 99: mpmc newmanual

MODEL SMALL:

DATA:

Data1 DW

Data2 DW

Data3 DW

Data4 DW

VIVA VOCE QUESTIONS

1. What do square brackets means when they appear in an operand?

2. What is the difference between MOV AX, 0 and SUB AX, AX?

3. Write a routine to swap nibbles in AL.

4. Which are pointers present in this 8086?

5. What is meant by Maskable interrupts?

Page 100: mpmc newmanual

Experiment No: Date:

8086-ASCENDING ORDER

AIM:

To write an assembly language program to arrange the given data in ascending Order

using 8086 microprocessor kit.

APPARATUS REQUIRED:

(i) 8086 Microprocessor kit with keyboard.

(ii) Power Cable.

ALGORITHM:

Step 1: Get the count 1, number of repetitions (length of array - 1) in B

register.

Step 2: Get the count 2, number of comparisons (length of array -1) in C

register.

.

Step 3: Move the data from memory location pointed to the Accumulator.

Step 4: Compare the data from next memory location with the content of

Accumulator.

Step5: Check CF. If carry flag is set (accumulator content is smaller than the

other number), decrement the repitition count

Step 6: Check ZF. If zero flag is set (accumulator content is equal to the other

number), decrement comparison count, otherwise do next step.

Step 7: Store the smallest number to the previous memory location & greatest

to the current memory location.

Step 8: Stop the Process.

Page 101: mpmc newmanual

FLOWCHART:

Start

Initialize memory pointer to get N, the length of series

Initialize COUNT 1 for (N-1) repetitions

Initialize COUNT 2 for (N-1) Comparisons

Increment memory pointer and get the number from series

IS pointer < NO Interchange

(pointer+1)? Numbers

YES

Decrement COUNT 2

NO

Is COUNT 2 =

Zero?

YES

Decrement COUNT 1

NO

Is COUNT 1 =

zero?

YES

Stop

Page 102: mpmc newmanual

DATA SEGMENT: A DB 5 DUP(0)

DATA ENDS

CODE SEGMENT: ASSUME CS: CODE, DS: DATA

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START: MOV CL,05H Move 05 to CL

MOV DL,05H Move 05 to DL

DEC CL Decrement CL

register

L1: MOV BX,00H Move 00H to BX

L2: MOV AL, A[BX] Move the 1st data to

AL

CMP AL, A[BX+1] Compare the 1st &

2nd

data

JB L3 If 1st data is lesser

than 2nd, goto L3

XCHG AL, A[BX+1] If 1st data is greater

than 2nd, exchange

the data

MOV A[BX], AL

Move AL content to

BX

L3: INC BX Increment BX by 1

LOOP L2 Goto L2

MOV DL,CL Move CL content to

DL

DEC DL Decrement DL

content

LOOP L1 If the count is not

zero, goto L1

END Stop the process

RESULT:

Thus the Assembly Language Program to arrange the given data in ascending Order

had been written and executed & the results were stored in desired memory location

Page 103: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. From which address the 8086 starts execution after reset?

2. What are the modes in which 8086 can operate?

3. What is the data and address size in 8086?

4. What is purpose served by CX register?

5. Which are pointers present in this 8086

Page 104: mpmc newmanual

Experiment No: Date:

8086-DESCENDING ORDER

AIM:

To write an assembly language program to arrange the given data in descending

Order using 8086 microprocessor kit.

APPARATUS REQUIRED:

(i) 8086 Microprocessor kit with keyboard.

(ii) Power Cable.

ALGORITHM:

Step 1: Get the count 1, number of repetitions (length of array - 1) in B

register.

Step 2: Get the count 2, number of comparisons (length of array -1) in C

register.

.

Step 3: Move the data from memory location pointed to the Accumulator.

Step 4: Compare the data from next memory location with the content of

Accumulator.

Step5: Check CF. If carry flag is set (accumulator content is smaller than the

other number), decrement the repitition count

Step 6: Check ZF. If zero flag is set (accumulator content is equal to the other

number), decrement comparison count, otherwise do next step.

Step 7: Store the smallest number to the previous memory location & greatest

to the current memory location.

Step 8: Stop the Process.

Page 105: mpmc newmanual

FLOWCHART:

Start

Initialize memory pointer to get N, the length of series

Initialize COUNT 1 for (N-1) repetitions

Initialize COUNT 2 for (N-1) Comparisons

Increment memory pointer and get the number from series

IS pointer < NO Interchange

(pointer+1)? Numbers

YES

Decrement COUNT 2

NO

Is COUNT 2 =

Zero?

YES

Decrement COUNT 1

NO

Is COUNT 1 =

zero?

YES

Stop

Page 106: mpmc newmanual

DATA SEGMENT: A DB 5 DUP(0)

DATA ENDS

CODE SEGMENT: ASSUME CS: CODE, DS: DATA

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START: MOV CL,05H Move 05 to CL

MOV DL,05H Move 05 to DL

DEC CL Decrement CL

register

L1: MOV BX,00H Move 00H to BX

L2: MOV AL, A[BX] Move the 1st data to

AL

CMP AL, A[BX+1] Compare the 1st &

2nd

data

JA L3 If 1st data is lesser

than 2nd, goto L3

XCHG AL, A[BX+1] If 1st data is greater

than 2nd, exchange

the data

MOV A[BX], AL

Move AL content to

BX

L3: INC BX Increment BX by 1

LOOP L2 Goto L2

MOV DL,CL Move CL content to

DL

DEC DL Decrement DL

content

LOOP L1 If the count is not

zero, goto L1

END Stop the process

RESULT:

Thus the Assembly Language Program to arrange the given data in desscending

Order had been written and executed & the results were stored in desired memory location

Page 107: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. Suppose that DS=1000h, SS=2000h, BP=1000h and DI=0100h. Determine

the memory address accessed by each of the following instruction.

MOV AL, [BP + DI]

2. Form a jump instruction that jumps to the address pointed by the BX register?

3. What is the difference between JUMP and LOOP instructions?

4. What is the instruction needed to count the number of 1’s found in AL?

5. What conditional jump instruction should be used after CMP AL, 30H to

jump when AL equals 30H?

Page 108: mpmc newmanual

Experiment No: Date:

8051-ADDITION OF TWO 8-BIT NUMBERS

AIM:

To perform the addition of two 8 bit numbers using immediate addressing and store

the result in memory.

APPARATUS REQUIRED:

(i) 8051 Microprocessor.

(ii) Power Cable.

ALGORITHM:

Step 1: Clear register Ro

Step 2: Get the data in accumulator.

Step 3: Add the second data with the first data.

Step 4: Make the data pointer to point the address 4500H.

Step 5: Check the carry flag. If no carry occur, go to step 7, otherwise do next

step.

Step 6: Increment the register Ro.

Step 7: Store the sum (content of accumulator)to the address pointed by the data

pointer.

Step 8: Make the data pointer to point the next address by increment the DPTR.

Step 9: Store the carry to that address.

Step 10: Stop the process.

Page 109: mpmc newmanual

FLOWCHART:

Start

Get first data in accumulator & clear Ro reg

Make DP to point 4500H

ADD second data with accumulator

Is NO

Carry

Set

YES

Increment Ro reg

Store Sum and Carry in memory using DP

Stop

Page 110: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 4100H MOV Ro,#00H Move the data 00H

to reg Ro. 4102H MOV A,#data1 Move the first data

in accumulator 4104H ADD A,#data2 Add the second data

with the

accumulator. 4106H MOV DPTR, #4500H Move the address

4500H to DPTR. 4109H JNC LOOP If no carry occurs go

to address 410C. 410BH INC Ro Increment the

DPTR. LOOP 410CH MOV X@DPTR,A Move the data from

accumulator to the

address pointed by

DPTR

410DH INC DPTR Increment the DPTR

410EH MOV A, Ro Move the content

from reg Ro to the

accumulator.

410FH MOV @ DPTR, A Move the data from

accumulator to the

address denoted by

DPTR

4110H NOP No operation.

RESULT:

Thus the addition of two 8-bit data using immediate addressing is performed and

executed.

Page 111: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. What is called microcontroller?

2. What is the difference between microprocessor and microcontroller?

3. How many flags are there in 8051

4. How many addressing modes are in 8051

5. What is called Datapointer?

Page 112: mpmc newmanual

Experiment No: Date:

8051-SUBTRACTION OF TWO 8-BIT NUMBERS

AIM:

To perform the subtraction of two 8 bit numbers using immediate addressing and

store the result in memory.

APPARATUS REQUIRED:

(i) 8051 Microprocessor.

(ii) Power Cable.

ALGORITHM:

Step 1: Clear register Ro

Step 2: Get the data in accumulator.

Step 3: Subtract the second data with the first data.

Step 4: Make the data pointer to point the address 4500H.

Step 5: Check the carry flag. If no carry occur, go to step 7, otherwise do next

step.

Step 6: Increment the register Ro.

Step 7: Store the difference (content of accumulator)to the address pointed by the

data pointer.

Step 8: Make the data pointer to point the next address by increment the DPTR.

Step 9: Store the borrow to that address.

Step 10: Stop the process.

Page 113: mpmc newmanual

FLOWCHART:

Start

Get first data in accumulator & clear Ro reg

Make DP to point 4500H

Subtract second data with accumulator

Is NO

Borrow

Obtained

YES

Increment Ro reg

Store Difference and Borrow in memory using DP

Stop

Page 114: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 4300H MOV Ro,#00H Move the data 00H

to reg Ro. 4302H MOV A,#data1 Move the first data

in accumulator 4304H SUB A,#data2 Subtract the second

data with the

accumulator. 4306H MOV DPTR, #4500H Move the address

4500H to DPTR. 4309H JNC LOOP If no carry occurs go

to address 410C. 430BH INC Ro Increment the

DPTR. LOOP 430CH MOV X@DPTR,A Move the data from

accumulator to the

address pointed by

DPTR

430DH INC DPTR Increment the DPTR

430EH MOV A, Ro Move the content

from reg Ro to the

accumulator.

430FH MOV @ DPTR, A Move the data from

accumulator to the

address denoted by

DPTR

4310H NOP No operation.

RESULT:

Thus the subtraction of two 8-bit data using immediate addressing is performed and

executed.

Page 115: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1 . How many registers are in 8051

2. What is called Immediate addressing mode?

3. What is called Indirect addressing mode?

4. How many flags are affected in SUB instructions

5. How many bytes is used for the instruction MOV DPTR, #4500H instruction

Page 116: mpmc newmanual

Experiment No: Date:

8051-MULTIPICATION OF TWO 8-BIT NUMBERS

AIM:

To write an 8051 assembly language program to multiply two 8-bit numbers and store

the result in memory.

APPARATUS REQUIRED:

(i) 8051 Microprocessor.

(ii) Power Cable.

ALGORITHM:

Step 1: Get the first data in accumulator.

Step 2: Get the second data in reg B.

Step 3: Multiply two 8-bit data.

Step 4: Get the data pointer to point the address 4500H.

Step 5: Store the LSB of the result from the accumulator to the address pointed by

DPTR.

Step 6: Increment the data pointer.

Step 7: Store the MSB of the result in the address pointed by DPTR.

Step 8: Stop the process.

Page 117: mpmc newmanual

FLOWCHART:

Start

Clear carry flag

Get multiplicand in accumulator

Get multiplier in B reg

Multiply accumulator with B

Store the result in memory

Stop

Page 118: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 4300H MOV A,#data1 Move the data 1 to

accumulator. 4302H MOV F0,#data2 Move the data 2 the

reg B. 4305H MUL B Multiply A & B. 4306H MOV DPTR, #4500H Move the address

4500H to DPTR. 4309H MOV X@DPTR,A Move the data from

accumulator to the

address pointed by

DPTR 430AH INC DPTR

Increment the

DPTR. 430BH MOV A,B Move the content of

B reg to the

accumulator.

430DH MOV X@DPTR,A Move the data from

accumulator to the

address denoted by

DPTR.

430EH NOP No operation.

RESULT:

Thus the Assembly Language Program for the multiplication of two 8-bit data has

been written and executed & the results are stored in desired memory location.

Page 119: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. What is F0 in this instruction MOV F0,#data?

2. What is called Stack pointer?

3. Define Flag register

4. What is the use of this instruction MOVX@ DPTR, A?

5. What type of addressing mode is used for the instruction MUL AB?

Page 120: mpmc newmanual

Experiment No: Date:

8051-DIVISION OF TWO 8-BIT NUMBERS

AIM:

To write an 8051 assembly language program to divide two 8-bit numbers and store

the result in memory.

APPARATUS REQUIRED:

(i) 8051 Microprocessor.

(ii) Power Cable.

ALGORITHM:

Step 1: Get the first data in accumulator.

Step 2: Get the second data in reg B.

Step 3: Divide two 8-bit data.

Step 4: Get the data pointer to point the address 4500H.

Step 5: Store the Quotient of the result from the accumulator to the address pointed by

DPTR.

Step 6: Increment the data pointer.

Step 7: Store the remainder of the result in the address pointed by DPTR.

Step 8: Stop the process.

Page 121: mpmc newmanual

FLOWCHART:

Start

Clear carry flag

Get dividend in accumulator

Get divisor in B reg

Divide accumulator with B

Store the result in memory

Stop

Page 122: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 4300H MOV A,#data1 Move the data 1 to

accumulator. 4302H MOV F0,#data2 Move the data 2 the

reg B. 4305H DIV B Divide A by B. 4306H MOV DPTR, #4500H Move the address

4500H to DPTR. 4309H MOV X@DPTR,A Move the data from

accumulator to the

address pointed by

DPTR 430AH INC DPTR

Increment the

DPTR. 430BH MOV A,B Move the content of

B reg to the

accumulator.

430DH MOV X@DPTR,A Move the data from

accumulator to the

address denoted by

DPTR.

430EH NOP No operation.

RESULT:

Thus the Assembly Language Program for the division of two 8-bit data has been

written and executed & the results are stored in desired memory location

Page 123: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. The mnemonics used in writing a program is called

_______________________

2. What is called Fetch Cycle?

3. What is called Direct addressing mode?

4. What is called Implied addressing mode?

5. What is the use of POP instruction?

Page 124: mpmc newmanual

Experiment No: Date:

8051-ADDITION OF TWO 16-BIT NUMBERS

AIM:

To perform the addition of two 16 bit numbers using immediate addressing and store

the result in memory.

APPARATUS REQUIRED:

(i) 8051 Microprocessor.

(ii) Power Cable.

ALGORITHM:

Step 1: Clear register Ro

Step 2: Make the datapointer to point the address 4500 and move first data LB to R1

register.

Step 3: Increment the datapointer and move the firtdata HB to R2 register.

Step 4: Increment the datapointer and add the LB of 1st data with LB of 2

nd data and

store in R1 register.

Step 5: Increment the datapointer and add with carry HB of 2nd

data with HB of 1st

data.

Step 6 :Check the carry flag. If no carry occur, go to step8 , otherwise do next

step.

Step 7: Increment the register Ro.

Step 8: Store the sum (content of accumulator)to the address pointed by the data

pointer.

Step 9: Make the data pointer to point the next address by increment the DPTR.

Step 10: Store the carry to that address.

Step 11: Stop the process.

Page 125: mpmc newmanual

FLOWCHART:

Start

Clear R0 reg, Make DP to point 4500H

Add LB of 1st and 2

nd data

ADD with carry HB of2nd data with 1st

Is NO

Carry

Set

YES

Increment Ro reg

Store Sum and Carry in memory using DP

Stop

Move 1st data LB to R1 reg

.Increment DPTR move 1st data

HB to R2 reg.Increment DPTR

Increment DPTR

Page 126: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 4100H MOV Ro,#00H Move the data 00H

to reg Ro. 4102 MOV DPTR, #4500H Move the address

4500H to DPTR 4105 MOV X A,@DPTR Move the data from

address pointed by

DPTR to the

accumulator 4106 MOV R1,A Move the content of

LB of 1st data from

accumulator to reg

R1 4107 INC DPTR Increment Data

pointer 4108 MOV X A,@DPTR Move the data from

address pointed by

DPTR to the

accumulator 4109 MOV R2,A Move the content of

LB of 1st data from

accumulator to reg

R2 410A INC DPTR Increment Data

pointer 410B MOV X A,@DPTR Move the data from

address pointed by

DPTR to the

accumulator 410C ADD A,RI Add the content of

LB of 2nd

data from

reg R1with

accumulator 410D MOV R1,A Move the content of

accumulator to reg

R1 410E INC DPTR Increment Data

pointer 410F MOV X A,@DPTR Move the data from

address pointed by

DPTR to the

accumulator

4110 ADDC A,R2 Add with carry the

content of HB of 2nd

data from reg R2

with accumulator 4111 MOV R2,A Move the content of

Page 127: mpmc newmanual

accumulator to the

reg R2. 4112 JNC LOOP If no carry occurs go

to address 4115 4114 INC Ro Increment reg R0 LOOP 4115 MOV A,R1 Move the content of

reg R1 to

accumulator 4116 INC DPTR .Increment the

DPTR. 4117 MOV X@DPTR,A Move the data from

accumulator to the

address pointed by

DPTR 4118 MOV A,R2 Move the content of

reg R2 to

accumulator

4119 INC DPTR Increment the DPTR

411A MOVX @ DPTR, A Move the data from

accumulator to the

address pointed by

DPTR

411B MOV A,R0 Move the content of

reg R0 to

accumulator

411C INC DPTR Increment the DPTR

411D MOVX @ DPTR, A Move the data from

accumulator to the

address pointed by

DPTR

411E NOP No operation.

RESULT:

Thus the addition of two 8-bit data using immediate addressing is performed and

executed.

Page 128: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. What is the use of POP instruction?

2. What is called Vector Location?

3. Define Interrupt?

4. What is the length of Stack pointer?

5. What is the length of Instruction Register?

Page 129: mpmc newmanual

Experiment No: Date:

TRANSFERING A BLOCK OF DATA FROM INTERNAL TO EXTERNAL

MEMORY

AIM:

To write an Assembly Language Program to transfer the block of data starting from

Internal memory location 31 to the memory location 4401H. The total number of data is

stored at 4400H.

APPARATUS REQUIRED:

(i) 8051 Microprocessor.

(ii) Power Cable.

ALGORITHM:

Step 1: Make the data pointer to point the address 4400H.

Step 2: Move the total number of data to the R0 register.

Step 3: Move the internal RAM Memory location 31 to the register R1.

Step 4: Increment the destination block pointer.

Step 5: Move the indirect Ram to the accumulator.

Step 6: Store the first data to the destination address.

Step 7: Increment the source block pointer.

Step 8: Decrement the R0 register.

Step 9: If ZF=0, go to step 4.otherwise go to next step.

Step 10: Stop the Process.

Page 130: mpmc newmanual

FLOWCHART:

Start

Move DPTR to point to 4400

Load the total number of input data In R0 reg

Move direct byte 31 to R1 reg.

Store data byte to destination block

Increment the source & destination block pointer

Decrement R0 reg

NO

If

ZF=1

YES

Stop

Page 131: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 4200H MOV DPTR, #4400H Move the address

4400H to DPTR 4203 MOV X A,@DPTR Move the data from

address pointed by

DPTR to the

accumulator 4204 MOV R0,A Get count of total

number of data bytes

in R0 reg. 4205 MOV R1,#31 Move immediate

data to the reg R1 LOOP 4207 INC DPTR Increment

datapointer 4208 MOV A,@R1 Movev indirect

RAM to accumulator 4209 MOV X @DPTR,A Move the data from

accumulator to the

address pointed by

DPTR 420A INC R1 Increment the

register R1 420B DEC R0 Decrement the

register R0 420C JNZ LOOP If ZF=0,program

control jump to

label. 420E NOP No operation

RESULT:

Thus the assembly language program to transfer the block of data from Internal

memory location 31 to 4401H has been written and verified.

Page 132: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. What is the length of Memory Address Register?

2. What is the length of Data buffer Register?

3. What is the length of Program Counter?

4. What is the length of Temporary Register?

5. What is the length of Accumulator?

Page 133: mpmc newmanual

Experiment No: Date:

TRANSFERING A BLOCK OF DATA FROM EXTERNAL TO EXTERNAL

MEMORY

AIM:

To write an Assembly Language Program to transfer the block of data starting from

memory location 4501H to 4800H. The total number of data is stored at 4500H.

APPARATUS REQUIRED:

(i) 8051 Microprocessor.

(ii) Power Cable.

ALGORITHM:

Step 1: Make the data pointer to point the address 4500H.

Step 2: Move the total number of data to the R0 register.

Step 3: Move the Higher order byte of source to R1 register

Step 4: Move the Higher order byte of destination to R2 register

Step 5: Move the content of register R1 to datapointer.

Step 6: Increment the destination block pointer.

Step 7: Store the first data to the destination address.

Step 8: Decrement the R0 register.

Step 9: If ZF=0, go to step 5.otherwise go to next step.

Step 10: Stop the Process.

Page 134: mpmc newmanual

FLOWCHART:

Start

Move DPTR to point 4500

Move 45 to R1 and 48 to R2 reg

Move count to R0 and R1 reg content to DPH

Store data byte to destination block

Increment the source & destination block pointer

Decrement R0 reg

NO

If

ZF=1

YES

Stop

Page 135: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 4300H MOV DPTR, #4500H Move the address

4300H to DPTR 4303H MOV R1,#45H Move the higher

order byte of Data

pointer to R1

register. 4305H MOV R2,#48H Move the direct data

to R2 register. 4307H MOV X A,@DPTR Move the data from

address pointed by

DPTR to the

accumulator 4308H MOV R0,A Get count of total

number of data bytes

in R0 reg. LOOP 4309H MOV DPH,R1 Move the content of

the reg R1 to higher

order byte of thev

Datapointer. 430B INC DPTR Increment

datapointer 430C MOV X A,@DPTR Move the data from

address pointed by

DPTR to the

accumulator 430D MOV DPH,R2 Move the content of

the register R2 to the

destination 430F MOV X @DPTR,A Move the data from

accumulator to the

address pointed by

DPTR 4310 DEC R0 Decrement the

register R0 4311 JNZ LOOP If ZF=0,program

control jump to

label. 4313 NOP No operation

RESULT:

Thus the assembly language program to transfer the block of data from memory

location 4501H to 4800H has been written and verified.

Page 136: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. How many I/O ports can be accessed in Direct Method?

2. How many lines are there in address bus

3. What is called Program Counter?

4. What is called Instruction Register ?

5. What is the direction of databus?

Page 137: mpmc newmanual

Experiment No: Date:

ASCII TO ITS EQUIVALENT HEXADECIMAL CONVERSION

AIM:

To write an Assembly Language Program to convert a ASCII number to

Hexadecimal number. The ASCII data is stored in 4600H and Hexadecimal data is store in

4601H.

APPARATUS REQUIRED:

(i) 8051 Microprocessor.

(ii) Power Cable.

ALGORITHM:

Step 1: Make the data pointer to point the address 4600H.

Step 2: Move the ASCIIl number to accumulator.

Step 3: Move the direct byte 30 to the register R1.

Step 4: Subtract with borrow the content of the register R1 with the accumulator.

Step 5:Increment the Data pointer.

Step 6: Store the equivalent hexa decimal number to the datapointer.

Step 7: Stop the Process.

Page 138: mpmc newmanual

FLOWCHART:

Move Hexadecimal num to Acc

Mov 30 to R1 reg and Sub with Acc

Increment DPTR

Move the result to DPTR

STOP

Move DPTR to point 4600

START

Page 139: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 4300H MOV DPTR, #4600H Move the address

4600H to DPTR 4303 MOV X A,@DPTR Move the data from

address pointed by

DPTR to the

accumulator 4304 MOV R1,#30 Move the direct byte

to the register R1 4306 SUBB A,R1 Subtract with borrow

the content of

register R1 with

accumulator 4307 INC DPTR Increment

datapointer 4308 MOV X @DPTR,A Move the data from

accumulator to the

address pointed by

DPTR 4309 NOP No operation

RESULT:

Thus the assembly language program to convert a ASCII number to equivalent

Hexadecimal number has been written and verified.

Page 140: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. Which byte of an instruction is loaded into IR register

2. What is the length of Stackpointer?

3. What is the length of Status word?

4. How many interrupts are there in 8051

5. What is PSW?

Page 141: mpmc newmanual

Experiment No: Date:

HEXADECIMAL TO ITS EQUIVALENT ASCII CONVERSION

AIM:

To write an Assembly Language Program to convert a Hexadecimal number to its

equivalent ASCII number The Hexadecimal data is stored in 4600H and ASCII data is

stored in 4601H.

APPARATUS REQUIRED:

(i) 8051 Microprocessor.

(ii) Power Cable.

ALGORITHM:

Step 1: Make the data pointer to point the address 4600H.

Step 2: Move the content of datapointer to accumulator.

Step 3: Move the direct byte 30 to the register R1.

Step 4: Add the content of the register R1 with the accumulator.

Step 5:Increment the Data pointer.

Step 6: Store the equivalent ASCII number to the datapointer.

Step 7: Stop the Process.

Page 142: mpmc newmanual

FLOWCHART:

Move Hexadecimal num to Acc

Mov 30 to R1 reg and add with Acc

Increment DPTR

Move the result to DPTR

STOP

Move DPTR to point 4600

START

Page 143: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 4300H MOV DPTR, #4600H Move the address

4600H to DPTR 4303H MOV X A,@DPTR Move the data from

address pointed by

DPTR to the

accumulator 4304H MOV R1,#30 Move the direct byte

to the register R1 4306H ADD A,R1 Add the content of

register R1 with

accumulator 4307H INC DPTR Increment

datapointer 4308H MOV X @DPTR,A Move the data from

accumulator to the

address pointed by

DPTR 4309H NOP No operation

RESULT:

Thus the assembly language program to convert a ASCII number to equivalent

Hexadecimal number has been written and verified

Page 144: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. How many I/o ports can be accessed by direct method

2. How many I/o ports can be accessed by Memory mapped method

3. What is called Vectored Interrupt?

4. What is called Maskable interrupt?

5. When interrupt service request is serviced

.

Page 145: mpmc newmanual

Experiment No:

Date:

8085-ASCENDING ORDER

AIM:

To write an Assembly Language Program to arrange the given data in Ascending

Order.

APPARATUS REQUIRED:

(i) 8051 Microprocessor.

(ii) Power Cable.

ALGORITHM:

Step 1: Move the datapointer to point to 4500H

Step 2: Get the count 1, number of repetitions (i.e., total number of data-1) in R0

register.

Step 3: Get the count 2, number of comparisons (i.e., total number of data-1) in A

register.

Step 4: Save the count 2 in R1 register.

Step 5: Move the datapointer to point to 4501H

Step 6: Move DPL to R2

Step 7: Move the 1st data to B register and increment DPTR and move the 2

nd data to

the

accumulator.

Step 8: Compare the data from next memory location with the content of

accumulator.

Step 9: Compare and jump if not equal goto step11 else do next step.

Step 10: Check ZF. If zero flag is set goto step else do next step

Step 11: check CF. If carry flag is not set (accumulator content is smaller than the

other number), go to step 13 otherwise do next step.

Step 12: Store the smallest number to the previous memory location & greatest to

the current memory location.

Step 13: Decrement the number of comparisons (count 2).

Step 14: If the number of comparison is not equal to zero, go to step 6, otherwise

do the next step.

Step 15: Decrement the number of repetitions (count 1).

Step 16: If the number of repetitions is not completed go to step 3, otherwise do

next step.

Step 17: Stop the Process.

Page 146: mpmc newmanual

FLOWCHART 8051-ASCENDING ORDER

Start

Initialize Datapointer to get N the length of series

Initialize COUNT 1 for (N-1) repetitions

Initialize COUNT 2 for (N-1) Comparisons

Increment memory pointer and get the number from series

IS pointer < NO Interchange

(pointer+1)? Numbers

YES

Decrement COUNT 2

NO

Is COUNT 2

Zero?

YES

Decrement COUNT 1

NO

Is COUNT 1

zero?

YES

Store sum as result

Stop

Page 147: mpmc newmanual

PROGRAM FOR SORTING A SERIES IN ASCENDING ORDER

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START 4100 MOV DPTR,#4500

4103 MOVX A,@DPTR

4104 DEC A

4105 MOV R0,A R0 = COUNT 1

for (N-

1)repetitions

AGAIN 4106 MOV A,R0

4107 MOV R1,A R1= COUNT 2

for (N-

1)Comparisons

4108 MOV DPTR,#4501

BACK 410B MOV R2,DPL 410D MOVX A,@DPTR

410E MOV B,A

4110 INC DPTR

4111 MOVX A,@DPTR

4112 CJNE A,B LOOP1 Compare

consecutive

numbers

4115 JZ SKIP

LOOP1 4117 JNC SKIP

4119 MOV DPL,R2

411B MOVX @DPTR,A

411C INC DPTR

411D MOV A,B Interchange

numbers if not in

order 411F MOVX @DPTR,A

SKIP 4120 DJNZ R1,BACK Decrement

count2

4122 DJNZ R0,AGAIN Decrement count

1

4124 NOP Stop the Process

RESULT:

Thus the Assembly Language Program to arrange the given data in ascending order

has been written and executed & the results are stored in desired memory location.

Page 148: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. Which interrupt remains enabled even after a reset operation

2. What instruction is used to enable the interrupt?

3. What instruction is used to enable the TRAP interrupt?

4. What is the use of RIM instruction?

5. What is the purpose of READY signal?

Page 149: mpmc newmanual

Experiment No: Date:

8051-DESCENDING ORDER

AIM:

To write an Assembly Language Program to arrange the given data in Descending

Order.

APPARATUS REQUIRED:

(i) 8051 Microprocessor.

(ii) Power Cable.

ALGORITHM:

Step 1: Move the datapointer to point to 4500H

Step 2: Get the count 1, number of repetitions (i.e., total number of data-1) in R0

register.

Step 3: Get the count 2, number of comparisons (i.e., total number of data-1) in A

register.

Step 4: Save the count 2 in R1 register.

Step 5: Move the datapointer to point to 4501H

Step 6: Move DPL to R2

Step 7: Move the 1st data to B register and increment DPTR and move the 2

nd data to

the

accumulator.

Step 8: Compare the data from next memory location with the content of

accumulator.

Step 9: Compare and jump if not equal goto step11 else do next step.

Step 10: Check ZF. If zero flag is set goto step else do next step

Step 11: check CF. If carry flag is set (accumulator content is smaller than the

other number), go to step 13 otherwise do next step.

Step 12: Store the smallest number to the previous memory location & greatest to

the current memory location.

Step 13: Decrement the number of comparisons (count 2).

Step 14: If the number of comparison is not equal to zero, go to step 6, otherwise

do the next step.

Step 15: Decrement the number of repetitions (count 1).

Step 16: If the number of repetitions is not completed go to step 3, otherwise do

next step.

Step 17: Stop the Process.

Page 150: mpmc newmanual

FLOWCHART 8051-DESCENDING ORDER

Start

Initialize Data pointer to get N the length of series

Initialize COUNT 1 for (N-1) repetitions

Initialize COUNT 2 for (N-1) Comparisons

Increment memory pointer and get the number from series

IS pointer < NO Interchange

(pointer+1)? Numbers

YES

Decrement COUNT 2

NO

Is COUNT 2

zero?

YES

Decrement COUNT 2

NO

Is COUNT 1

zero?

YES

Store sum as result

Stop

Page 151: mpmc newmanual

PROGRAM FOR SORTING A SERIES IN DESCENDING ORDER

LABEL ADDRESS MNEMONIC OPCODE OPERAND COMMENTS

START 4100 MOV DPTR,#4500

4103 MOVX A,@DPTR

4104 DEC A

4105 MOV R0,A R0 = COUNT 1

for (N-

1)repetitions

AGAIN 4106 MOV A,R0

4107 MOV R1,A R1= COUNT 2

for (N-

1)Comparisons

4108 MOV DPTR,#4501

BACK 410B MOV R2,DPL 410D MOVX A,@DPTR

410E MOV B,A

4110 INC DPTR

4111 MOVX A,@DPTR

4112 CJNE A,B LOOP1 Compare

consecutive

numbers

4115 JZ SKIP

LOOP1 4117 JC SKIP

4119 MOV DPL,R2

411B MOVX @DPTR,A

411C INC DPTR

411D MOV A,B Interchange

numbers if not in

order 411F MOVX @DPTR,A

SKIP 4120 DJNZ R1,BACK Decrement

count2

4122 DJNZ R0,AGAIN Decrement count

1

4124 NOP Stop the Process

RESULT:

Thus the Assembly Language Program to arrange the given data in descending order

has been written and executed & the results are stored in desired memory location.

Page 152: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

VIVA VOCE QUESTIONS

1. What is the purpose of ALE signal?

2. What addressing mode is used in the instruction MOV A,#data1?

3. What addressing mode is used in the instruction MOVX @DPTR, A?

4. What addressing mode is used in the instruction ADD A,R1?

5. What addressing mode is used in the instruction MOV A,@R1?

Page 153: mpmc newmanual

Experiment No: Date:

FILLING EXTERNAL MEMORY

AIM:

To write an Assembly Language Program to fill the data starting from memory

location 4200H to 4300H. The total number of data is stored at 4500H

APPARATUS REQUIRED:

(i) 8051 Microprocessor.

(ii) Power Cable.

ALGORITHM:

Step 1: Make the data pointer to point the address 4500H.

Step 2: Move the total number of data to the R0 register.

Step 3: Increment datapointer.

Step 4: Move the first data to Accumulator

Step 5: Make the data pointer to point the address 4200H.

Step 6: Store the first data to the destination address .

Step 7: Increment the destination block pointer.

Step 8:.Decrement the R0 register.

Step 9: If ZF=0, go to step 6.otherwise go to next step.

Step 10: Stop the Process.

Page 154: mpmc newmanual

FLOWCHART:

Start

Move DPTR to point 4500

Move count to R0 reg

Increment DPTR move 1st data to Accmulator

Move DPTR to point 4200

Store the data in the deastination address

II

Decrement R0 reg

NO

If

ZF=1

YES

Stop

Increment Data pointer`

Page 155: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 4100H MOV DPTR, #4500H Move the address

4500H to DPTR 4103H MOV X A,@DPTR Move the data from

address pointed by

DPTR to the

accumulator 4104H MOV R0,A Move the content of

accumulator to R0

register. 4105H INC DPTR Increment

datapointer 4106H MOV X A,@DPTR Move the data from

address pointed by

DPTR to the

accumulator 4107H MOV DPTR, #4200H Move the address

4200H to DPTR LOOP1 410AH MOV X @DPTR,A Move the data from

accumulator to the

address pointed by

DPTR 410BH INC DPTR Increment

datapointer 410CH DEC R0 Decrement the

register R0 410DH JNZ LOOP1 If ZF=0,program

control jump to

label.

410FH NOP No operation

RESULT:

Thus the assembly language program to fill the data starting from memory location

4200H to 4300H and internal memory 30 to 40 has been written and verified.

Page 156: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT

OUTPUT

OUTPUT

VIVA VOCE QUESTIONS

1. What is the use of JUMP instruction?

2. How many ports are used in 8051

3. The crystal oscillator is connected to pins__________

&________________

4. What is the use of RST pin?

5. “Pushing the stack” refers to___________ operation in a LIFO memory.

Page 157: mpmc newmanual

Experiment No: Date:

STEPPER MOTOR INTERFACE

AIM:

To run a stepper motor at different speed in two directions.

APPARATUS REQUIRED:

(i) 8085 Microprocessor.

(ii) Power Cable.

(iii)Stepper Motor Interface.

THEORY:

The hardware setup consists of a microprocessor motherboard and stepper motor

interface board. The motherboard consists of 8085 MPU, 8KB EPROM, 8KB RAM,

Keyboard and display controller 8279, 21-key Hex-keypad and six numbers of seven segment

LEDs and Bus Expansion connector. The stepper motor interface consists of driver transistors

for stepper motor windings and address decoding circuit. The microprocessor output the

binary sequence through data bus, which are converted to current pulses by the driver

transistors and used to drive stepper motor. The software for the system is developed in 8085

assembly language.

ALGORITHM:

Step 1: Initialize HL register pair with address 4150H.

Step 2: Initialize register B with total number of data for rotation.

Step 3: Get the data for rotation in accumulator.

Step 4: Send the data from accumulator to port address of stepper motor interface.

Step 5: Initialize DE register pair with data 030H.

Step 6: Decrement DE register pair.

Step 7: Check the value of DE reg pair. If it is not equal to zero go to step 3.

Otherwise go to step 1.

Page 158: mpmc newmanual

FLOWCHART: Start

Initialize HL reg with 411AH & Initialize B reg with 04H

Get data for rotation in accumulator

Send data to port address

Initialize DE reg pair with 0303H

Décrément DE reg

Is NO

DE=00

YES

Increment HL reg pair

Decrement B reg

Is NO

B=0

YES

Page 159: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 4100H LXI H,411AH 21 1A,41 Initialize HL reg with

411AH. 4103H MVI B,04H 06 04 Load data 04H to B reg. REPEAT 4105H MOV A,M 7E Send data to

accumulator. 4106H OUT C0H D3 C0 Send data to output port. 4108H LXI D,0303H 11 03,03 Initialize DE reg pair

with 0303H. DELAY 410BH NOP 00 No operation.

410CH DCX D 1B Decrement DE reg pair.

410DH MOV A,E 7B Move data from E to A.

410EH ORA D B2 OR the accumulator

content with D reg.

410FH JNZ DELAY C2 0B,41 If DE#0, go to DELAY.

4112H INX H 23 Increment HL reg pair.

4113H DCR B 05 Decrement B reg.

4114H JNZ REPEAT C2 05,41 If B#0, go to REPEAT.

4117H JMP START C3 00,41 Go to start.

Unipolar steeping scheme:

Two Phase Steeping Scheme:

RESULT:

Thus the program has been written and the stepper motor is rotated in two directions.

The stepper motor is also rotated at different speed.

clock wise Anticlock wise

Step A1 A2 B1 B2 A1 A2 B1 B2

1 1 0 0 0 1 0 0 0

2 0 0 0 1 0 0 1 0

3 0 1 0 0 0 1 0 0

4 0 0 1 0 0 0 0 1

clock wise Anticlock wise

Step 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

Page 160: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

INPUT 411AH 0A 09 Data to rotate in

forward direction

411BH 06 05

411CH 05 06

411DH 09 0A

OUTPUT Stepper motor Rotated in forward Direction

VIVA VOCE QUESTIONS

1. What is the use of JUMP instruction?

2. How many machine cycles needed for the execution of ORA?

3. What is the difference between unipolar and two phase steeping

scheme?

4. A state during which nothing happens is known as

________________

5. microprocessor 8085 is the enhanced version of ____________ with

essentially the same construction set

Page 161: mpmc newmanual

Experiment No: Date:

ADC INTERFACING

AIM:

To write a program to initiate ADC and to store the digital data in memory

APPARATUS REQUIRED:

8085 Trainer Kit

ADC Interface board

THEORY:

The ADC0809 is an 8-bit successive approximation type ADC with inbuilt 8-channel

multiplexer. The ADC0809 is suitable for interface with 8086 microprocessor. The

ADC0809 is available as a 28 pin IC in DIP (Dual Inline Package). The ADC0809 has a

total unadjusted error of ±1 LSD (Least Significant Digit).The ADC0808 is also same as

ADC0809 except the error. The total unadjusted error in ADC0808 is ± 1/2 LSD.

ALGORITHM:

Step 1: Load data 10 to accumulator.

Step 2: Send the data from accumulator to output port address of ADC interface

Step 3: clear accumulator.

Step 4: Load data 10 to accumulator

Step 5: Send the data from accumulator to output port address of ADC interface

Step 6: Send the data from accumulator to input port address of ADC interface

Step 7: AND the contents 01 with accumulator and compare with it.

Step 8:check for zero flag if not set go to step 6,otherwise do the next step

Step 9: Send the data from accumulator to input port address of ADC interface

Step10:store the result and stop the operation

Page 162: mpmc newmanual

Decrement b-reg

START

TT

FLOWCHART:

Initialize HL reg with 411AH & Initialize B reg with 04H

Get data for rotation in accumulator

Send data to port address

Initialize DE reg pair with 0303H

Is NO

DE=00

YES

Increment HL reg pair

Decrement B reg

Is NO

B=0

YES

Page 163: mpmc newmanual

PROGRAM:

ADDRESS LABEL MNEMONICS OPCODE OPERAND COMMENTS

4100 START: MVI A,10 Load 10 to A-reg

4101 OUT C8 Send data to output

port

4102 MVI A,10 Load 10 to A-reg

4103 OUT C8 Send data to output

port

4104 MVI A,10 Load 10 to A-reg

4105 OUT D0 Send data to output

port

4106 XRA A Clear accumulator

4107 XRA A Clear accumulator

4108 XRA A Clear accumulator

4109 MVI A,00 Load 00 to A-reg

410A OUT D0 Send data to output

port

410B LOOP IN D8 Send data to input

port

410C ANI 01 And 01 with

accumulator

410D CPI 01 Compare 01 with

accumulator

410E JNZ LOOP If zero flag is not

set,go to specified

label

4111 IN C0 Send data to input

port

4112 STA 4150 Store accumulator

4115 HLT Stop operation

RESULT:

Thus the ADC was initiated and the digital data was stored at desired location

Page 164: mpmc newmanual

OBSERVATION:

Compare the data displayed at the LEDs with that stored at location 4150

VIVA VOCE QUESTIONS

1. What is the difference between LXI H,4100 and LHLD 4100?

2. What are the application of microprocessor?

3. What is called LIFO?

4. How many interrupts are there in 8085?

5. Which group of ports of 8255 PPI can be operated in 2modes

Page 165: mpmc newmanual

.Experiment No: Date

DAC INTERFACING

AIM:

To interface DAC with 8085 to demonstrate the generation of square,saw tooth and

rectangular wave.

APPARATUS REQUIRED:

8085 Trainer Kit

DAC Interface board

THEORY:

DAC 0800 is an 8-bit DAC and the output voltage variation is between -5V and + 5V. the

output voltage varied in steps of 10/256=0.04(appx). The digital data input and the

corresponding output voltages are presented in the table.1

Input Data in

HEX

Output Voltage

00 -5.00

01 -4.96

02 -4.92

… …

7F 0.00

… …

FD 4.92

FE 4.96

FF 5.00

Referring to Table.1, with 00H as input to DAC,the analog output is -5v. Similarly, with FFH

as input ,The output is +5v. Outputting digital data 00 and FF at regular intervals to

DAC,results in different waveforms namely square,triangular etc. the port address of DAC is

08H.

ALGORITHM:

1. SQUARE WAVE GENERATION:

(i) Load the initial value (00) to accumulator and move it to DAC

(ii) Call the delay program

(iii) Load the final value (FF) to accumulator and move it to DAC

(iv) Call the delay program

(v) Repeat steps 2 to 5

Page 166: mpmc newmanual

2. SAW TOOTH WAVE GENERATION:

(i) Load the initial value 00 to accumulator

(ii) Move the accumulator content to DAC

(iii) Increment the accumulator content by 1

(iv) Repeat steps 3 and 4.

3. TRIANGULAR WAVE GENERATION:

(i) Load the initial value (00) to accumulator

(ii) Move the accumulator content to DAC

(iii) Increment the accumulator content by1

(iv) If accumulator content is zero proceed to next step. Else go to step 3

(v) Load value (FF) to accumulator

(vi) Move the accumulator content to DAC

(vii) Decrement the accumulator content by 1

(viii) If accumulator content is zero go to step2. Else go to step 7.

Page 167: mpmc newmanual

FLOWCHART:

SQUARE WAVEFORM

Start

Move data to 00H to A

Call Delay subroutine

Move data FFH to A

Call Delay subroutine

Jump

DELAY:

Start

Move data FFH to C reg & 05 to B reg

Decrement C reg

YES Is

C#0

NO

Decrement B reg

Is YES

B#0

NO

Return

Page 168: mpmc newmanual

FLOWCHART:

SAWTOOTH WAVEFORM

Start

Move data to 00H to A

Increment A

If

YES There is

No zero

NO

YES

Jump

NO

Stop

Page 169: mpmc newmanual

TRIANGULAR WAVEFORM

Start

Move data 00H to L reg

Move L reg to Accumulator

Increment the reg L

If

YES There is

No zero

NO

Move data to FFH to L reg

Move L reg to Accumulator

Decrement the reg L

If

YES There is

No zero

NO

YES

Jump

NO

Stop

Page 170: mpmc newmanual

PROGRAM:

Square Wave Generation:

ADDRESS LABEL MNEMONICS OPCODE OPERAND COMMENTS

4100 START: MVI A,00 Load 00 to

accumulator

4101 OUT C8 Send data to output

port

4102 CALL DELAY Call operation

4103 OUT C8 Load 00 to

accumulator

4104 CALL DELAY Call operation

4105 JMP START Jump tothe label

specified

4106 DELAY: MVI B,05 Load 05 to B-reg

4107 L1: MVI C,FF Load FF to C-reg

4108 L2: DCR C Dec C-reg

4109 JNZ L2 Jump to the label

specified if zero

flag is not set

410A DCR B Decrement B-reg

410B JNZ L1 Jump to the label

specified if zero

flag is not set

410C RET Return to the

mainprogram

Saw tooth Wave Generation:

ADDRESS LABEL MNEMONICS OPCODE OPERAND COMMENTS

4100 START: MVI A,00 Load 00 to

accumulator

4101 L1 OUT C8 Load 00 to

accumulator

4102 INR A Increment A-reg

4103 JNZ L1 Jump to the label

specified if zero flag

is not set

4104 JMP START Jump to the label

specified

Page 171: mpmc newmanual

Triangular Wave Generation:

ADDRESS LABEL MNEMONICS OPCODE OPERAND COMMENTS

4100 START: MVI L,00 Load 00 to L-

reg

4101 L1: MOV A,L Load 00 to

accumulator

4102 OUT C8 Send data to

output port

4103 INR L incrementL-

reg

4104 JNZ L1 Jump to the

label

specified if

zero flag is

not set

4107 MVI L,FF Load FF to L-

reg

4108 L2: MOV A,L Load FF to

accumulator

4109 OUT C8 Send data to

output port

410A DCR L Decrement L-

reg

410B JNZ L2 Jump to the

label

specified if

zero flag is

not set

410E JMP START Jump to the

label

specified

RESULT:

Thus the square,triangular and saw tooth waveform were generated by interfacing DAC with

8085 trainer kit..

Page 172: mpmc newmanual

VIVA VOCE QUESTIONS

1. Write the two ways to initialize stack pointer at FFFFH?

2. Define instruction set?

3. is it possible to check AC flag status of 8085,how??

4. What is difference between PUSH and POP instruction?

5. How many flags are affected for the HALT?

Page 173: mpmc newmanual

Experiment No: Date:

TRAFFIC LIGHT CONTROLLER

AIM:

To control the traffic light system with an 8085 microcontroller program.

APPARATUS REQUIRED:

(i) 8085 Microprocessor.

(ii) Power Cable.

(iii)Traffic Light Interfacing.

(iii)Lights for traffic signaling.

THEORY:

The traffic lights are interfaced to Microprocessor system through buffer and ports of

programmable peripheral Interface 8255.So the traffic lights can be automatically switched

ON/OFF in desired sequence. The Interface board has been designed to work with parallel

port of Microprocessor system. The hardware of the system consists of two parts. The first

part is Microprocessor based system with 8085. Microprocessor as CPU and the peripheral

devices like EPROM, RAM, Keyboard & Display Controller 8279, Programmable as

Peripheral Interface 8255, 26 pin parallel port connector, 21 keys Hexa key pad and six

number of seven segment LED’s. The second part is the traffic light controller interface

board, which consist of 36 LED’s in which 20 LED’s are used for vehicle traffic and they are

connected to 20 port lines of 8255 through Buffer. Remaining LED’s are used for pedestrian

traffic. The traffic light interface board is connected to Main board using 26 core flat cables

to 26-pin Port connector. The LED’s can be switched ON/OFF in the specified sequence by

the Microprocessor.

Page 174: mpmc newmanual

ALGORITHM:

Step 1: Initialize HL pair with 4500H and C reg with 02H.

Step 2: Send control word to CNT register.

Step 3: Send data to port A & B.

Step 4: Call delay and increment HL pair.

Step 5: Decrement C reg.

Step 6: if C=0 go to step 1, otherwise go to step 3.

Page 175: mpmc newmanual

FLOWCHART:

Start

Initialize HL pair with 4500H & C reg with 02H

Send control word to CNT reg

Send data to port A & B

Call Delay

Increment HL pair

Decrement C register

If NO

C=0

YES

Page 176: mpmc newmanual

DELAY:

PUSH BC reg pair to stack

Move 05H to C reg

Load the DE with FFFFH

Décrément DE reg pair

Is NO

DE=0

YES

Décrément C reg

NO Is

C=0

YES

POP stack to BC rerg

Return

Page 177: mpmc newmanual

PROGRAM:

LABEL ADDRESS MNEMONICS OPCODE OPERAND COMMENTS

START 4100H LXI H,4500H 21 00,45 Initialize HL pair with

4500H ` 4103H MVI C,02H 0E 02 Move data 02H to C reg. 4105H MOV A,M 7E Get data from memory to

accumulator. 4106H OUT CNT D3 0F Send data to control reg. LOOP1 4108H INX H 232 Increment HL pair reg. 4109H MOV A,M 7E Get data from memory to

accumulator. 410AH OUT APRT D3 0C Send data to port A. 410CH INX H 23 Increment HL pair reg. 410DH MOV A,M 7E Get data from memory to

accumulator. 410EH OUT BPRT D3 0D Send data to port B. 4110H CALL

DELAY

CD 1B,41 Call delay routine.

4113H INX H 23 Increment HL pair reg. 4114H DCR C 0D Decrement HL pair. 4115H JNZ LOOP1 C2 09,41 If C reg value is non-zero

go to loop1. 4118H JMP START C3 00,41 Go to start. DELAY 411BH MVI B.05H 06 05 Move 05H to B reg. LOOP3 411DH LXI D,FFFFH 11 FF,FF Initialize DE reg pair with

FFFFH. LOOP2 4120H DCX D 1B Decrement DE reg pair. 4121H MOV A,D 7A Move data from D to A

reg. 4122H ORA E B3 OR reg with E reg. 4123H JNZ LOOP2 C2 20,41 Go to loop2. 4126H DCR B 05 Decrement B reg. 4127H JNZ LOOP3 C2 1D,41 Go to loop3.

412AH RET 09 Return.

RESULT:

Thus the Assembly Language Program to control the traffic light system has been

written and output is verified.

Page 178: mpmc newmanual

OBSERVATION:

ADDRESS DATA COMMENTS

4500H 80 Control Word

4501H 1A First Step Data

4502H A1 First Step Data

4503H 81 Second Step Data

4504H 5A Second Step Data

VIVA VOCE QUESTIONS

6. What is the use of latch?

7. What is the use of IN/OUT instruction?

8. What addressing mode is used for the instruction MOV A,M?

9. What is called buffer?

10. How many modes are there in 8255

Page 179: mpmc newmanual

Experiment No: Date

KEYBOARD / DISPLAY CONTROLLLER

AIM:

To interface 8279 Programmable Keyboard Display Controller to 8085 Microprocessor.

APPARATUS REQUIRED:

8085 Microprocessor toolkit

8279 Interface Board

VXT Parallel bus

Regulated D.C Power supply

THEORY:

& 310 A programmable keyboard and display interfacing chip. It Scans and encodes up to a 64-ey

keyboard and it controls up to a 16-digit numerical display. The keyboard section has a built-

in FIFO 8 character buffer. The display is controlled from an internal 16x8 RAM has stores

the coded display information.

Page 180: mpmc newmanual

PROGRAM:

RESULT:

Thus 8279 controller was interfaced with 8085 and program for rolling display was executed

successfully.

ADDRESS LABEL MNEMONICS OPCODE OPERAND COMMENTS

4100 START: LXI H,4130H Initialize HL pair

with 4130H

4101 MVI D,0FH Load 0F to D-reg

4102 MVI A,10H Load 10 to A-reg

4103 OUT C2H Send data to

outport port

4104 MVI A,CCH Load CC to A-reg

4107 OUT C2H Send data to

outport port

4108 MVI A,90H Load 90 to A-reg

4109 OUT C2H Send data to

outport port

410A LOOP: MOV A,M Move content of

memory to

accumulator

410B OUT C0H Send data to

outport port

410E CALL

DELAY

Call delay

4121 INX H Increment HL pair

4122 DCR D Decrement D-reg

4123 JNZ LOOP Jump to the label

specified if zero

flag is not set

4126 JMP START Jump to the label

specified

4129 DELAY: MVI B,A0H Load A0 to B-reg

412B LOOP2 MVI C,FFH Load FF to C-reg

412D LOOP1 DCR C Decrement C-reg

412E JNZ LOOP1 Jump to the label

specified if zero

flag is not set

4131 DCR B Decrement B-reg

4132 JNZ LOOP2 Jump to the label

specified if zero

flag is not set

4135 RET Return to the main

program

Page 181: mpmc newmanual

OBSERVATION:

Pointer equal to 4130 FF repeated eight times.

4130 -FF

4131 -FF

4132 –FF

4133 -FF

4134 -FF

4135 -FF

4136 -FF

4137 -FF

4138 -FF

4139 -FF

413A -FF

413B–FF

413C -FF

413D-FF

413E-FF

413F-FF

VIVA VOCE QUESTIONS

11. What is the use of CALL instruction?

12. What is the use of RETURN instruction?

13. What addressing mode is used for the instruction MVI C,FF?

14. What is the Jump range?

15. How many machine cycles are used for the instruction LXI H,4130H

Page 182: mpmc newmanual

Experiment No: Date

RAM ADDRESING

AIM:

To exhibit the RAM direct addressing and bit addressing schemes of 8051 microcontroller.

APPARATUS REQUIRED:

8051 Interfacing board

power supply

ALGORITHM:

For Bit addressing, select Bank 1 of RAM by setting 3rd

bit of PSW

Using Register 0 of Bank 1 and accumulator perform addition

For direct addressing provide the address directly(30 in this case)

Use the address and Accumulator to perform addition

Verify the results.

Page 183: mpmc newmanual

PROGRAM:

Bit Addressing:

SETB PSW.3

MOV R0,#data1

MOV A,#data2

ADD A,R0

MOV DPTR,#4500

MOVX @DPTR,A

HERE: SJMP HERE

Direct Addressing:

MOV 30,#data1

MOV A,#data2

ADD A,30

MOV DPTR,#4500

MOVX @DPTR,A

HERE: SJMP HERE

OBSERVATION:

Bit Addressing:

INPUT : 54

25

OUTPUT: 79(4500)

Direct Addressing:

INPUT : 54

25

OUTPUT: 79(4500)

RESULT:

Thus the program to exhibit different RAM addressing schemes of 8051 was executed.

Page 184: mpmc newmanual
Page 185: mpmc newmanual
Page 186: mpmc newmanual