You are on page 1of 61

DrNNCE

IT/IVSEM

MP&MCLABLM

CS2259-MICROPROCESSOR AND MICROCONTROLLER LABORATORY LABORATORY MANUAL FOR IV SEMESTER B.TECH / IT A CA D E M I C Y E A R : 2 0 1 2 - 2 0 1 3 (FOR PRIVATE CIRCULATION ONLY) ANNA UNIVERSITY, CHENNAI. NAME REG.NO BATCH : : :

DEPARTMENT OF INFORMATION TECHNOLOGY DR.NAVALAR NEDUNCHEZHIAYN COLLEGE OF ENGINEERING, THOLUDUR-606303, CUDDALORE DIST.
1

DrNNCE

IT/IVSEM

MP&MCLABLM

GENERAL INSTRUCTIONS FOR LABORATORY CLASSES

DOS o o o o o o o Without Prior permission do not enter into the Laboratory. While entering into the LAB students should wear their ID cards. The Students should come with proper uniform. Students should sign in the LOGIN REGISTER before entering into the laboratory. Students should come with observation and record note book to the laboratory. Students should maintain silence inside the laboratory. After completing the laboratory exercise, make sure to shutdown the system properly.

DONTS o Students bringing the bags inside the laboratory.. o Students wearing slippers/shoes insides the laboratory. o Students using the computers in an improper way. o Students scribbling on the desk and mishandling the chairs. o Students using mobile phones inside the laboratory. o Students making noise inside the laboratory.

DrNNCE

IT/IVSEM

MP&MCLABLM

HARDWARE REQUIREMENTS: Microprocessor 8085,8086,8051 Kit

UNIVERSITY PRACTICAL EXAMINATION ALLOTMENT OF MARKS


INTERNAL ASSESMENT PRACTICAL ASSESMENT
TOTAL

: 20 MARKS : 80 MARKS
: 100 MARKS

INTERNAL ASSESMENT (20 MARKS)


Staff should maintain the assessment and the head of the department should monitor it. SPLIT UP OF INTERNAL MARKS
OBSERVATION RECORD NOTE MODEL EXAM ATTENDANCE TOTAL : 3 MARKS : 7 MARKS : 5 MARKS : 5 MARKS : 20 MARKS

UNIVERSITY EXAMINATION
The Exam will be conducted for 100 marks. Then the marks will be converted to 80 marks.

ALLOCATION OF MARKS
AIM AND RESULT ALGORITHM & FLOWCHART PROGRAM EXECUTION VIVA VOCE TOTAL : 10 MARKS : 20 MARKS : 30 MARKS : 30 MARKS : 10 MARKS : 100 MARKS

DrNNCE

IT/IVSEM

MP&MCLABLM

ANNAUNIVERSITY,CHENNAI CS2259-MICROPROCESSOR AND MICROCONTROLLER LAB


LIST OF EXPERIMENTS

1. Programming with 8085 2. Programming with 8086-experiments including BIOS/DOS calls: Keyboard control, Display, File Manipulation. 3. Interfacing 8085/8086 with 8255,8253 4. Interfacing 8085/8086 with 8279,8251 5. 8051 Microcontroller based experiments for Control Applications 6. Mini- Project

DrNNCE

IT/IVSEM

MP&MCLABLM

CONTENTS

Ex. No

Name of the Experiment

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13 14


Programs for 8-bit arithmetic operations using 8085 Programs for 16-bit arithmetic operations using 8085. Programs for sorting and searching operations using 8085. Programs for sorting and searching operations using 8086. Programs for string manipulation operations using 8086. Interfacing ADC and DAC. Parallel communication between two microprocessor kits using Mode 1 and Mode2 of 8255. Interfacing and programming 8279 Programming using arithmetic, logical and bit manipulation instructions of 8051 microcontroller. Serial communication between two microprocessor kits using 8251 Interfacing and programming 8253 Interfacing and programming of stepper motor and DC motor speed control
Beyond the Syllabus

13 20 26 31 40 46 54 57 63 65 72 58 59

Arithmetic programs to find square and cube Program to find LCM of a given number

Page No. 5

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 1 (a)


Title of the experiment Date of the experiment

: 8 BIT ADDITION USING 8085


:

OBJECTIVE (AIM) OF THE EXPERIMENT


To perform addition operation for two 8-bit numbers using 8085.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. Facilities Required Quantity 1 8085 Microprocessor Kit 1 2 DC Power Supply 5V 1 b) Procedure for doing the experiment: Sl.No. Details of the step 1 Load the first data from the memory to accumulator and move into B Register. 2 Load the second data from memory to accumulator. 3 Clear C register. Add the content of B register to accumulator. 4 Check for carry, if carry 1 go to step 1 else if carry 0 go to step 7. 5 Store the sum to memory. Move the carry to accumulator and store in memory. 6 Terminate the program. c) Program: ADDRESS OPCODE 4100 3A 00 42 4103 47 4104 3A 01 42 4107 0E 00 4109 80 410A D2 0E 41 410D 0C 410E 32 02 42 4111 79 4112 32 03 42 4115 76 d) Output:
ADDRESS 4200 4201

LABEL

AHEAD

MNEMONICS LDA 4200H MOV B,A LDA 4201H MVI C00H ADD B JNC AHEAD INR C STA 4202H MOV A,C STA 4203H HLT

COMMENTS Get first data in A Move A to B Get second data in A Clear C register to account for carry Get Sum in A reg If CY=0 go to AHEAD If CY=1 increment C reg Store the sum in memory Move C to A Store the carry in memory Terminate the program
OUTPUT

INPUT DATA E2 E5 ADDRESS 4202 4203

DATA 27 01

e) Result: Thus the program for 8-bit addition was implemented and verified successfully.

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 1 (b)


Title of the experiment Date of the experiment : 8 BIT SUBTRACTION USING 8085 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To perform subtraction operation for two 8-bit numbers using 8085.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8085 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 6 7 8 9 Details of the step Load the subtrahend(data to be subtracted) from the memory to accumulator and move into B Register. Load the minuend from memory to accumulator. Clear C register to account for sign of the result. Subtract the content of B register from the content of accumulator. Check for carry, if carry 1 go to step 6 else if carry 0 go to step 7. Increment C register, complement the accumulator and add 01H. Store the difference to memory. Move the content of C register to accumulator and store in memory Terminate the program

c) Program: ADDRESS 4100 4103 4104 4107 4109 410A 410D 410E 410F 4111 4114 4115 4118 OPCODE 3A 01 42 47 3A 00 42 0E 00 90 D2 11 41 0C 2F C6 01 32 02 42 79 32 03 42 76 MNEMONICS LDA 4201H MOV B,A LDA 4200H MVI C00H SUB B JNC AHEAD INR C CMA ADI 10H AHEAD STA 4202H MOV A,C STA 4203H HLT
7

LABEL

COMMENTS Get the subtrahend in B reg Move A to B Get the minuend in A reg Clear C register to account for sign Get Difference in A reg If CY=0 go to AHEAD If CY=1 increment C reg Get 2s complement of difference Result in A reg Store the sum in memory Move C to A Store the sign bit in memory Terminate the program

DrNNCE

IT/IVSEM

MP&MCLABLM

d) Output:

INPUT ADDRESS 4200 4201 DATA 5E 3A

OUTPUT ADDRESS 4202 4203 DATA 2A 00

e) Result: Thus the program for 8-bit Subtraction was implemented and verified successfully.

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 1 (c)


Title of the experiment Date of the experiment : 8 BIT MULTIPLICATION USING 8085 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To perform multiplication operation for two 8-bit numbers using 8085.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8085 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 6 7 8 9 10 11 12 Details of the step Load the address of the first data in HL pair. Clear C register for overflow. Clear the accumulator. Move the first data to B register. Increment the pointer. Move the second data to D register. Add the content of D register to accumulator. Check for carry, If carry=1 go to step 9 else carry=0 go to step 10. Increment the C register. Decrement the B register. Check whether count has reached zero. If ZF=0, repeat steps7 through 11 or of ZF=1 go to next step. Terminate the program.

c) Program: ADDRESS OPCODE 4100 21 00 42 4103 0E 00 4105 4106 4107 4108 4109 410A 410D AF 46 23 56 82 D2 0E 41 0C LABEL MNEMONICS LXI 4200H MVI C00H XRA A MOV B,M INX H MOV D,M ADD D JNC AHEAD INR C
9

COMMENTS Set pointer for data Clear C to account for overflow Clear accumulator Get first data in B reg Get second data in D reg Add D reg to accumulator If CY=1 increment C reg

REPT

DrNNCE

IT/IVSEM

MP&MCLABLM

ADDRESS 410E 410F 4112 4113 4114 4115 4116


OPCODE 05 C2 09 41 23 77 23 71 76

LABEL AHEAD

MNEMONICS DCR B JNC REPT INX H MOV M,A INX H MOV M,C HLT

COMMENTS Repeat addition until ZF=1 Store lower byte of product in memory Store higher byte of product in memory Terminate the program

d) Output:

INPUT ADDRESS 4200 4201 DATA 07 4A

OUTPUT ADDRESS 4202 4203 DATA 86 39

e) Result: Thus the program for 8-bit Multiplication was implemented and verified successfully.

10

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 1 (d)


Title of the experiment Date of the experiment : 8 BIT DIVISION USING 8085 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To perform division operation for two 8-bit numbers using 8085.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8085 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 6 7 8 9 Details of the step Load the divisor in accumulator and move it to B reg. Load the dividend in accumulator. Clear C-Register to account for quotient. Check whether divisor is less than dividend. If divisor is less than dividend, go to step 8 otherwise go to next step. Subtract the content of B reg from accumulator. Increment the content of C reg, go to step 4. Store the content of accumulator in memory. Move the content of C reg to accumulator and store in memory. Terminate the program.

c) Program: ADDRESS 4100 4103 4104 4107 4109 410A 410D 410E 410F 4112 4115 4116 4119 OPCODE LABEL 3A 01 42 47 3A 00 42 0E 00 B8 AGAIN DA 12 41 90 0C C3 09 41 32 03 42 STORE 79 32 02 42 76 MNEMONICS LDA 4201H MOV B,A LDA 4200H MVI C00H CMP B JC STORE SUB B INR C JMP AGAIN STA 4203H MOV A,C STA 4202H HLT
11

COMMENTS Get the divisor in B reg Get the dividend in A reg Clear C reg for Quotient If divisor is less than dividend go to STORE Subtract divisor from dividend Increment quotient by 1 for each subtraction Store the remainder in memory Store the quotient in memory

DrNNCE

IT/IVSEM

MP&MCLABLM

d) Output: INPUT ADDRESS 4200 4201 e) Result: Thus the program for 8-bit Division was implemented and verified successfully. DATA C9 0A OUTPUT ADDRESS 4202 4203 DATA 14 01

QUESTIONS AND ANSWERS:


1. What is the timing diagram? The graphical representation of the instruction execution steps with respect to time is called timing diagram. 2. What are the interrupts signals in 8085? The interrupt signals in 8085 are TRAP, RST 7.5, RST 6.5,RST 5.5, INTR 3. What is an assembler? An assembler is a program that translates the mnemonics into their machine code. Additional instructions can be inserted anywhere in the program and the assembler will reassign all the new memory locations and jump locations. 4. Give the purpose of HLDA. HLDA Hold Acknowledge is used to indicate that the microprocessor will release control over its system buses. 5. What is instruction cycle? It is the time required to complete the execution of an instruction. The 8085 instruction cycle has one to six machine cycles. 6. What is interrupt? It is the process by which the external devices use microprocessor for servicing by suspending the routine process served previously. It is classified into Hardware and software interrupts. 7. What is microprocessor? It is a multipurpose, programmable, clock driven, register based electronic device that reads the binary instruction from a storage device called memory, accepts binary data as input, process the data according to the instruction and provides the result.

12

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 2 (a)


Title of the experiment Date of the experiment : 16 BIT ADDITION USING 8085 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To perform addition operation for two 16-bit numbers using 8085.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8085 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 6 7 8 9 Details of the step Load the first data in HL register pair. Move the first data to DE reg pair. Load the second data in HL reg pair. Clear A reg for carry. Add the content of DE pair to HL pair. Check for carry. If CARRY=1, go to step 7 or if CARRY=0, go to step 8. Increment A reg to account for carry. Store the sum and carry in memory. Terminate the program.

c) Program: ADDRESS 4100 4103 4104 4107 4108 4109 410C 410D 4110 4113 OPCODE LABEL 2A 00 42 EB 2A 02 42 AE 19 D2 0D 41 3C 22 04 42 AHEAD 32 06 42 76 MNEMONICS LHLD 4200H XCHG LHLD 4202H XRA A DAD D JNC AHEAD INR A SHLD 4202H STA 4206H HLT COMMENTS Get first data in HL pair Save first data in DE pair Get second data in HL pair Clear A reg for carry Get the sum in HLpair If CY=0, goto AHEAD If CY=1, increament A reg Store the sum in memory Store the carry in memory Terminate the program.

13

DrNNCE

IT/IVSEM

MP&MCLABLM

d) Output:

INPUT ADDRESS 4200 4201 4202 4203 DATA 54 C2 92 8A

OUTPUT ADDRESS 4204 4205 4206 4207 DATA E6 4C 01 -

e) Result: Thus the program for 16-bit Addition was implemented and verified successfully.

14

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 2 (b)


Title of the experiment Date of the experiment : 16 BIT SUBTRACTION USING 8085 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To perform Subtraction operation for two 16-bit numbers using 8085.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8085 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 6 7 8 9 Details of the step Load the low byte of subtrahend in accumulator from memory and move it to the B reg. Load the low byte of minuend in accumulator from memory. Subtract the content of B reg from the content of Accumulator. Store the low byte of result in memory. Load the high byte of subtrahend in accumulator from memory and move it to B reg. Load the high byte of minuend in accumulator from memory. Subtract the content of B reg and the carry from the content of Accumulator. Store the high byte of result in memory. Terminate the program.

c) Program: ADDRESS 4100 4103 4104 4107 4108 410B 410E 410F 4112 4113 4116 OPCODE 3A 02 42 47 3A 00 42 90 32 04 42 3A 03 42 47 3A 01 42 98 32 05 42 76 LABEL MNEMONICS LDA 4202H MOV B,A LDA 4200H SUB B STA 4204H LDA 4203H MOV B,A LDA 4201H SBB B STA 4205H HLT COMMENTS Get low byte of subtrahend in B reg Get low byte of minuend in A reg Get difference of low bytes in A reg Store the result in memory Get high byte of subtrahend in B reg Get high byte of minuend in A reg Get difference of high bytes in A reg Store the result in memory Terminate the program.

15

DrNNCE

IT/IVSEM

MP&MCLABLM

d) Output:

INPUT ADDRESS 4200 4201 4202 4203 DATA Ab B2 2c 92

OUTPUT ADDRESS 4204 4205 DATA 7F 20 -

e) Result: Thus the program for 16-bit Subtraction was implemented and verified successfully.

QUESTIONS AND ANSWERS:


1. What is the use of instruction queue in 8086? The queue operates on the principle FIFO. So the execution unit gets the instruction for execution in the order they are fetched. Hence instruction queue is required. 2. What is the addressing mode of the following instruction? MOV AX,55H(BX)(SI) Base indexed memory addressing mode. 3. How clock signal is generated in 8086? The crystal oscillator in 8284 generates a square wave signal at the same frequency as the crystal. 4. What is the maximum internal clock frequency of 8086? The maximum internal clock frequency of 8086 is 5MHZ 5. What is the size of physical memory of 8086 microprocessor? Size of physical memory = 2 20 = 1MB 6. What is the size of virtual memory of 8086 microprocessor? Size of virtual memory = 2 16 = 64 kB

16

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 2 (c)


Title of the experiment Date of the experiment : 16 BIT MULTIPLICATION USING 8085 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To perform multiplication operation for two 16-bit numbers using 8085.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8085 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Details of the step Load the first data in HL register pair and move to SP. Load the second data in HL register pair and move to DE. Clear HL pair. Clear BC pair for overflow. Add the content of SP pair to HL pair. Check for carry. If CARRY=1, go to step 7 or if CARRY=0, go to step 8. Increment BC pair . Decrement the count. Check whether count has reached zero. To check for zero of the count, move the content of E reg to A reg and logically or with D reg. Check the zero flag if ZF=0 repeat step 5 through 11 or if ZF=1 goto next step. Store the content of HL in memory. Move the content of C to L and B to H and store HL in memory. Terminate the program.

c) Program: ADDRESS 4100 4103 4104 4107 4108 410B 410E OPCODE LABEL 2A 00 42 F9 2A 02 42 EB 21 00 00 01 00 00 39 NEXT MNEMONICS LHLD 4200H SPHL LHLD 4202H XCHG LXIH 0000H LXIB 0000H DAD SP
17

COMMENTS Get first data in HL pair Save first data in SP pair Get second data in HL pair Save Second data in DE pair Clear HLpair(initial sum=0) Clear BC pair to account overflow Add the content of SP to sum(HL)

DrNNCE

IT/IVSEM

MP&MCLABLM

410F 4112 4113 4114 4115 4116 4119 411C 411D 411E 4121

02 13 41 03 1B 7B B2 C2 0E 41 22 04 42 69 60 22 06 42 76

AHEAD

JNC AHEAD INX B DCX D MOV A,E ORA D JNZ NEXT SHLD 4204H MOV L,C MOV H,B SHLD 4206H HLT

If CY=1,increment BC pair. Check for zero in DE pair this is done logically. OR D and E Repeat addition until count is zero Store lower 16 bit of product in memory

Store upper 16 bit of product in memory Terminate the program.

d) Output:

INPUT ADDRESS 4200 4201 4202 4203 e) Result: DATA 24 5A C2 47

OUTPUT ADDRESS 4204 4205 4206 4207 DATA 48 4B 44 19

Thus the program for 16-bit Multiplication was implemented and verified successfully.

QUESTIONS AND ANSWERS:


1. What is pipelining? The feature of fetching the next instruction while the current instruction is executing is called pipelining. 2. How many Data lines and address lines are available in 8086? Address lines = 20 or 20 bit address bus Data lines = 16 or 16 bit data bus

18

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 3 (a)


Title of the experiment Date of the experiment : ASCENDING ORDER USING 8085 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to sort an array of data in ascending order.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8085 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 6 7 8 9 10 Details of the step Load the count value from memory to A register and save it in B register. Decrement B register. Set HL pair as data array address pointer. Set C register as counter for N-1 comparison. Load the data of the array in accumulator using the data address pointer. Increment the HL pair. Compare the data pointed by HL with accumulator. If carry flag is set then goto step 10 else goto next step Exchange the content of memory pointed by HL and accumulator. Decrement C reg. If zero flag is reset goto step 6 else goto next step. Decrement B reg. If zero flag is reset goto step 3 else goto next step. Terminate the program.

c) Program: ADDRESS OPCODE 4100 3A 00 42 4103 4104 4105 4108 4109 410A 410B 410C 410D 410E 4111 47 05 21 00 42 4E 0D 23 7E 23 BE DA 16 41 56 LABEL MNEMONICS COMMENTS LDA 4200H load the count value in A reg MOV B,A DCR B LXIH 4200H MOV C,M DCR C INX H MOV A,M INX H CMP M JC AHEAD MOV D,M
19

Set count for N-1 repetition Set pointer for array Set count for N-1 comparison Increment pointer Get one data of array in A Compare next data with A reg If content of A is less than memory then goto AHEAD If the content A is greater than the content

LOOP2

LOOP1

DrNNCE

IT/IVSEM

MP&MCLABLM

of memory, then exchange content of memory pointed by HL and previous location 4112 4113 4114 4115 4116 4117 411A 411B 411E 77 2B 72 23 0D C2 0B 41 05 C2 05 41 76 AHEAD MOV M,A DCX H MOV M,D INX H DCR C JNZ LOOP1 DCR B JNZ LOOP2 HLT

Repeat comparison until count is zero Repeat N-1 comparison until B count is zero. Terminate the program.

d) Output: INPUT ADDRESS DATA 4200 07 4201 4202 4203 4204 4205 4206 4207 AB 92 84 4F 69 F2 34 OUTPUT ADDRESS DATA 4200 07 4201 4202 4203 4204 4205 4206 4207 34 4F 69 84 92 AB F2

e) Result: Thus the program for ascending order was implemented and verified successfully.

QUESTIONS AND ANSWERS:


1. What is sorting? Arranging the items either from smallest to largest or from largest to smallest is called sorting. 2. What is a bus? Bus is a group of conducting lines that carries data, address and control signals. 3. Why data bus is bi-directional? The microprocessor has to fetch (read) the data from memory or input device for processing and after processing, it has to store (write) the data to memory or output device. Hence the data bus is bi- Directional.

20

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 3 (b)


Title of the experiment Date of the experiment : Descending Order using 8085 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to sort an array of data in descending order.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8085 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. Details of the step 1 Load the count value from memory to A register and save it in B register. 2 Decrement B register. Set HL pair as data array address pointer. 3 Set C register as counter for N-1 comparison. 4 Load the data of the array in accumulator using the data address pointer. 5 Increment the HL pair. Compare the data pointed by HL with accumulator. 6 If carry flag is reset then goto step 10 else goto next step 7 Exchange the content of memory pointed by HL and accumulator. 8 Decrement C reg. If zero flag is reset goto step 6 else goto next step. 9 Decrement B reg. If zero flag is reset goto step 3 else goto next step. 10 Terminate the program. c) Program: ADDRESS OPCODE 4100 3A 00 42 4103 4104 4105 4108 4109 410A 410B 410C 410D 410E 4111 47 05 21 00 42 4E 0D 23 7E 23 BE D2 16 41 56 LABEL MNEMONICS COMMENTS LDA 4200H load the count value in A reg MOV B,A DCR B LXIH 4200H MOV C,M DCR C INX H MOV A,M INX H CMP M JC AHEAD MOV D,M Set count for N-1 repetition Set pointer for array Set count for N-1 comparison Increment pointer Get one data of array in A Compare next data with A reg If content of A is greater than memory then goto AHEAD If the content A is less than the content of memory, then exchange content of memory pointed by HL and previous location

LOOP2

LOOP1

21

DrNNCE

IT/IVSEM

MP&MCLABLM

4112 4113 4114 4115 4116 4117 411A 411B 411E

77 2B 72 23 0D C2 0B 41 05 C2 05 41 76

AHEAD

MOV M,A DCX H MOV M,A INX H DCR C JNZ LOOP1 DCR B JNZ LOOP2 HLT

Repeat comparison until count is zero Repeat N-1 comparison until B count is zero. Terminate the program.

d) Output: INPUT ADDRESS DATA 4200 07 4201 C4 4202 4203 4204 4205 4206 4207 84 9A 7B E2 F4 B2 OUTPUT ADDRESS DATA 4200 07 4201 F4 4202 4203 4204 4205 4206 4207 E2 C4 B2 9A 84 78

e) Result: Thus the program for descending order was implemented and verified successfully.

QUESTIONS AND ANSWERS:


1. What is opcode fetch cycle? The opcode fetch cycle is a machine cycle executed to fetch the opcode of an instruction stored in memory. Every instruction starts with opcode fetch machine cycle. 2. What is asynchronous data transfer scheme? In asynchronous data transfer scheme, first the processor sends a request to the device for read/write operation. Then the processor keeps on polling the status of the device. Once the device is ready, the processor execute a data transfer instruction to complete the process. 3. What is the need for timing diagram? The timing diagram provides information regarding the status of various signals, when a machine cycle is executed. The knowledge of timing diagram is essential for system designer to select matched peripheral devices like memories, latches, ports, etc., to form a microprocessor system.

22

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 4 (a)


Title of the experiment Date of the experiment : Searching - Largest Data :

OBJECTIVE (AIM) OF THE EXPERIMENT


To search the largest data in an array using 8085 microprocessor.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8085 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 6 7 8 9 10 11 Details of the step Load the address first element of array in HL reg pair. Move the count of B reg. Increment the pointer. Get the first data in A reg. Decrement the count. Increment the pointer. Compare the counter of memory address by HL pair carry=0, goto step 10 else to step 9 with that of A move the content of HL to A reg. Decrement the count. If ZF=0, goto step 6 or if ZF=1 goto next step. Goto large data. Terminate the program.

c) Program: ADDRESS OPCODE 4100 21 00 42 4103 4104 4105 4106 4107 4108 4109 410C 46 23 7E 05 23 BE 02 00 41 7E LOOP LABEL MNEMONICS COMMENTS LXIH 4200H Set Pointer for array MOV B,M INX H MOV A,M DCR B INX H CMP M JNC AHEAD MOV A,M Set count for no of element in array Set first element of array as large data Decrement the count Compare an element of array with current largest data If CY=0, goto AHEAD If CY=1, then content of memory is larger than accumulator. Hence If CY=1, make

23

DrNNCE

IT/IVSEM

MP&MCLABLM

memory content as current largest by moving it to A reg 410D 410E 4111 4114 05 C2 07 41 32 00 42 76 AHEAD DCR B JNZ LOOP STA 4300H HLT Repeat comparison until count is zero Store the large data in memory Terminate the program

d) Output: INPUT ADDRESS 4200 4201 4202 4203 4204 4205 4206 4207 DATA 07 62 7D FC 24 C2 0F 92 4300 FC OUTPUT ADDRESS DATA

e) Result: Thus the program to find the largest data in an array is constructed and verified successfully.

QUESTIONS AND ANSWERS:


1. What is assembly language? The language in which the mnemonics (short -hand form of instructions) are used to write a program is called assembly language. The manufacturers of microprocessor give the nemonics.

2. What does the instruction LXIH,4200 mean? The data present in the address location 4200 is loaded into the H register.
3. How many machine cycles constitute one instruction cycle in 8085? Each instruction of the 8085 processor consists of one to five machine cycles. 4. What is the drawback in machine language and assembly language programs? The machine language and assembly language programs are machine dependent. The programs developed using these languages for a particular machine cannot be directly run on another machine .

24

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 4 (b)


Title of the experiment Date of the experiment : SEARCHING - SMALLEST DATA :

OBJECTIVE (AIM) OF THE EXPERIMENT


To search the smallest data in an array using 8085 microprocessor.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8085 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 6 7 8 9 10 11 12 Details of the step Load the address first element of array in HL reg pair. Move the count of B reg. Increment the pointer. Get the first data in A reg. Decrement the count. Increment the pointer. Compare the content of HL pair with A reg, If CY=1, goto step 10 elseto step 9 Move the content of memory address by HL to A reg. Decrement the count. If ZF=0, goto step 6 or if ZF=1 goto next step. Store the smallest data in memory. Terminate the program.

c) Program:

ADDRESS OPCODE 4100 21 00 42 4103 4104 4105 4106 4107 4108 4109 46 23 7E 05 23 BE DA 0D 41

LABEL

MNEMONICS COMMENTS LXIH 4200H Set Pointer for array MOV B,M INX H MOV A,M DCR B Set count for no of element in array Set first element of array as smallest data Decrement the count Compare an element of array with current smallest data If CY=1, goto AHEAD

LOOP

INX H CMP M JC AHEAD

25

DrNNCE

IT/IVSEM

MP&MCLABLM

410C

7E

MOV A,M

If CY=0, then content of memory is smaller than accumulator. Hence If CY=0, make memory content as current smallest by moving it to A reg Repeat comparison until count is zero Store the small data in memory Terminate the program

410D 410E 4111 4114

05 C2 07 41 32 00 42 76

AHEAD

DCR B JNZ LOOP STA 4300H HLT

d) Output: INPUT ADDRESS 4200 4201 4202 4203 4204 4205 4206 4207 e) Result: Thus the program to find the smallest data in an array is constructed and verified successfully. DATA 07 42 3A 1C 24 B4 25 4F 4300 1C OUTPUT ADDRESS DATA

QUESTIONS AND ANSWERS:


1. What is searching? Locating the particular data from the collection or sequence of data is called searching. 2. What does the instruction MOV A,M represent? The data present in the content of the memory location are moved to the accumulator. 3. Why address bus is unidirectional?
The address is an identification number used by the microprocessor to identify or access a memory location or I / O device. It is an output signal from the processor. Hence the address bus is unidirectional.

26

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 5 (a)


Title of the experiment:CONVERSION OF 2-DIGIT BCD TO BINARY NUMBER Date of the experiment :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to convert a 2-digit BCD(8-bit) data to Binary data.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8085 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 6 7 8 9 10 11 Details of the step Get the BCD data in A reg and save in E reg. Mark the lowest nibble (units) of the BCD data in A reg. Rotate the upper nibble to lower nibble position and save in B reg. Clear the accumulator. Move 0AH to C reg. Decrement C reg. If ZF=0,gato step 6 else ZF=1, goto next step. Save the product in B reg. Get the BCD data in A reg from E reg and mark the upper nibble. Add the content of A reg to product (B reg). Store the binary value(A reg). Terminate the program.

c) Program: ADDRESS OPCODE 4100 3A 00 42 4103 4104 4106 4107 4108 4109 410A 410B 410C 5F E6 F0 07 07 07 07 47 AF 0E 0A LABEL MNEMONICS COMMENTS LDA 4200H Get the data in D reg and save in E reg MOV E,A ANI F0H RLC RLC RLC RLC MOV B,A XRA A MVIC 0AH
27

Mark the lower nibble Rotate the upper nibble to lower nibble and save in B reg

REP

Clear accumulator Get the product terms digit multiplied

DrNNCE

IT/IVSEM

MP&MCLABLM

410E 410F 4110 4113 4114 4115 4117 4118 411B

80 00 C2 0E 41 47 7B E6 0F 80 32 01 42 76

ADD B DCR C JNZ REP MOV B,A MOV B,E ANI 0FH ADD B STA 4250H HLT

Save the product in B reg Get the BCD data in A reg Mask the upper nibble Get the sum of contents digit and the product in B reg Save the Binary value in memory Terminate the program

d) Output: INPUT ADDRESS 4200 DATA 45 OUTPUT ADDRESS 4250 DATA 2D

e) Result: Thus the program for BCD to Binary Conversion using 8085 was executed and verified successfully.

QUESTIONS AND ANSWERS:


1. What is the abbreviation of ASCII. ASCII American Code For Information Interchange. 2. What is Software?
The Software is a set of instructions or commands needed for performing a specific task by a programmable device or a computing machine.

28

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 5 (b)


Title of the experiment : CONVERSION OF 8-BIT BINARY NUMBER TO BCD Date of the experiment :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to convert a 8-bit Binary number to BCD.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8085 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 6 7 8 9 10 11 Details of the step Clear D and E reg to account for hundreds and tens. Load the binary data in A reg. Compare A reg with 64th if carry flag is set goto step 7 else goto next step. Subtract 64th from A reg. Increment E reg(hundreds) goto step 3 Compare the A reg with 0AH if carry flag is set goto step 1 else goto next step. Subtract 0AH from A reg. Increment D reg(tens) goto step 7. Combine the terms to form 8 bit result. Save the tens and hundred in memory. Terminate the program.

c) Program: ADDRESS OPCODE 4100 1E 00 4102 4103 4106 4108 410B 53 3A 00 42 FE 64 DA 11 41 06 64 LABEL MNEMONICS COMMENTS MVI E,00H Clear E reg for hundreds MOV D,E LDA 4200H CPI 64H JC TEN SUI 64H Clear D reg for tens Get the binary data in A reg Compare whether data is less than 100(or)64H If the content of A is less than 100(or)64H go to ten Subtract all the hundreds from the data and for each subtraction increment E reg

HUND

410D 410E

1C C3 06 41

INR E JMP HUND Compare whether the content of A is less than 0AH or 10

29

DrNNCE

IT/IVSEM

MP&MCLABLM

4111 4113 4116 4119 411C 411D 411E 411F 4120 4121 4122 4123 4126 4127 412A

FE 0A DA 1C 41 D6 0A C3 11 41 4F 7A 07 07 07 07 81 32 50 42 7B 32 51 42 76

TEN

CPI 0AH JC UNIT SUI 0AH JMP TEN MOV C,A MOV A,D RLC RLC RLC RLC ADD C STA 4250H MOV A,E STA 4251H HLT

If CY=1, go to UNIT Subtract all tens from the data and for each subtraction increment D reg Save the units in C reg Get tens in A reg Rotate tens digit to upper nibble position

UNIT

Combine tens and unit digit Save tens and units in memory Save hundreds in memory Terminate the program.

d) Output: INPUT ADDRESS 4200 DATA B9 4251 e) Result: Thus the program for Binary to BCD Conversion using 8085 was executed and verified successfully. 01 OUTPUT ADDRESS 4250 DATA 85

QUESTIONS AND ANSWERS:


1. What is Hardware?
The Hardware refers to the components or devices used to form computing machine in which the software can be run and tested. Without software the Hardware is an idle machine.

2. What does the instruction STA 4502 refer? The value of the accumulator is stored in memory location 4202.

30

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 5 (c)


Title of the experiment:CONVERSION OF 8-BIT BINARY NUMBER TO ASCII CODE Date of the experiment:

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to convert a 8-bit Binary number to ASCII Code.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8085 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Details of the step Load the given data in A reg and move to B reg. Mark the upper nibble of binary (Hexa) data in A reg. Call subroutine code to get ASCII code of the lower nibble and store in memory. 4 Move B reg to A reg and mark the lower nibble. 5 Rotate the upper nibble position. 6 Call subroutine code to get the ASCII code of upper nibble and store in memory. 7 Terminate the program. For Subroutine: 1 Compare the content of A reg with 0AH. 2 If CY=1 goto step 4, If CY=0 goto next step. 3 Add 07H to A reg. 4 Add 30H to A reg. 5 Return to main program. c) Program: ADDRESS 4100 4103 4104 4106 4109 410C 410D 410F 4110 OPCODE 3A 00 42 47 E6 0F CD 1A 41 32 01 42 78 E6 F0 07 07 LABEL MNEMONICS LDA 4200H MOV B,A ANI 0FH CALL CODE STA 4201H MOV A,B ANI F0H RLC RLC
31

Sl.No. 1 2 3

COMMENTS Get binary data in A Save the binary data in B reg Mask the upper nibble Call subroutine to get ASCII code Lower nibble in A and store in memory Get data in A reg Mark the lower nibble rotate upper nibble to lower nibble position

DrNNCE

IT/IVSEM

MP&MCLABLM

4111 4112 4113 4116 4119 411A 411C 411F 4121 4123

07 07 CD 1A 41 32 02 42 76 FF 0A 0A 21 41 C6 07 C6 30 C9 CODE

RLC RLC CALL CODE STA 4202H HLT CPI 0AH JC SKIP ADI 07H ADI 30H RET

Call subroutine to get ASCII code Upper nibble in A store in memory

If the content of A is less than 0AH then add 30H to A else add 37H to A reg

SKIP

Return to main program.

d) Output: INPUT ADDRESS 4200 DATA E4 4202 e) Result: Thus the program for ASCII code to Binary value Conversion using 8085 was executed and verified successfully. 45 OUTPUT ADDRESS 4201 DATA 34

QUESTIONS AND ANSWERS:


1. What is the function of microprocessor in a system? The microprocessor is the master in the system, which controls all the activity of the system. It issues address and control signals and fetches the instruction and data from memory. Then it executes the instruction to take appropriate action. 2. Define opcode and operand. Opcode (Operation code) is the part of an instruction / directive that identifies a specific peration.

32

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 5 (d)


Title of the experiment : CONVERSION OF ASCII CODE TO BINARY VALUE Date of the experiment :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to convert an array of ASCII Code to corresponding binary(hexa) value.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8085 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. Details of the step 1 Set HL pair as pointer for ASCII array. 2 Set D reg as counter for number of data in the array. 3 Set BC pair as pointer for binary(hexa) array. 4 Increment HL pair and move a data of ASCII array A reg. 5 Call subroutine BIN to find the binary (hexa) value. 6 The binary(hexa) value in A reg is stored in memory. 7 Increment BC pair. 8 Decrement D reg if ZF=0 then goto step 4, If ZF=1 then stop. 9 Terminate the program. For Subroutine: 1 Subtract 30H from A reg. 2 Compare the content of A reg with 0AH. 3 If CY=1 goto step 4, If CY=0 goto next step. 4 Subtract 07H from A reg. 5 Return to main program. c) Program: ADDRESS 4100 4103 4104 4107 4108 4109 410C OPCODE LABEL 21 00 42 56 01 00 43 23 LOOP 7E C6 13 41 02 MNEMONICS LXI H,4200H MOV D,M LXI B,4300H INX H MOV A,M CALL BIN STAX B COMMENTS Set pointer for ASCII array Set cont for number of data Set pointer for binary array Get an ASCII data in A reg Call subroutine to get binary Value in A and store in memory

33

DrNNCE

IT/IVSEM

MP&MCLABLM

410D 410E 410F 4112 4113 4115 4117 4118 411A

03 15 C2 07 41 76 06 30 FF 0A 08 06 07 C9 BIN

INX B DCR D JNZ LOOP HLT SUI 30H CPI 0AH RC SUI 07H RET

Increment the binary array pointer Repeat conversion until count is zero Terminate the program. Subtract 30H from the data If Y=1 return to main program If data is greater than H then subtract 07H Return to main program.

d) Output:

ASCII Array INPUT ADDRESS 4200 4201 4202 4203 4204 4205 4206 4207 e) Result: DATA 07 31 42 35 46 43 39 38

Binary (Hexa) Array OUTPUT ADDRESS 4300 4301 4302 4303 4304 4305 4306 DATA 01 0B 05 0F 0C 09 08 -

Thus the program for Binary to ASCII code Conversion using 8085 was executed and verified successfully.

QUESTIONS AND ANSWERS:


1. What are the register pairs in 8085? The register pair in 8085 microprocessor are BC, DE and HL register pair.

34

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 6 (a)


Title of the experiment Date of the experiment
: 16 BIT ADDITION USING 8086 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to add two 16-bit numbers using 8086 and store the result in memory.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. Facilities Required 1 8086 Microprocessor Kit 2 DC Power Supply 5V b) Procedure for doing the experiment: Sl.No. 1 2 3 4 Quantity 1 1

Details of the step Data are brought to 16 bit register. The contents of the register are added and store the carry and sum. Data are added in accumulator. Add data from 1100 to 1102 Result will be stored in address data 1200. Terminate the program.

c) Program: ADDRESS OPCODE 1000 A1 1001 00 1002 11 1003 03 1004 06 1005 02 1006 11 1007 A3 1008 0 1009 12 100A F4 d) Output: LABEL MNEMONICS MOV AX[1100] COMMENTS Initialize AX reg

ADD AX[1102]

Add the content of AX reg

MOV [1200],AX

Store the result in 1200 to accumulator

HLT

Terminate the program. Binary (Hexa) Array OUTPUT ADDRESS DATA 1200 68AC

ASCII Array INPUT ADDRESS DATA 1100 1234 1102 5678

e) Result: Thus the program for 16-bit addition using 8086 was executed and verified successfully.

35

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 6 (b)


Title of the experiment Date of the experiment : 16 BIT SUBTRACTION USING 8086 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to subtract two 16-bit numbers using 8086 and store the result in memory.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. Facilities Required 1 8086 Microprocessor Kit 2 DC Power Supply 5V b) Procedure for doing the experiment: Quantity 1 1

Sl.No. Details of the step 1 Data are brought to 16 bit register. Initialize the address register. 2 Data are added in accumulator. Subtract data from 1100 & 1102 3 Result will be stored in address 1200. 4 Terminate the program. c) Program: ADDRESS OPCODE 1000 A1 1001 00 1002 11 1003 2B 1004 06 1005 02 1006 11 1007 A3 1008 00 1009 12 100A F4 d) Output: LABEL MNEMONICS MOV AX[1100] COMMENTS Initialize AX reg Move the data to the A reg Subtract the data

SUB AX[1102]

MOV [1200],AX

Store the result in 1200 to accumulator

HLT

Terminate the program.

ASCII Array INPUT Binary (Hexa) Array OUTPUT ADDRESS DATA ADDRESS DATA 1100 99 1200 62 1101 99 1102 36 1201 FD 1103 9C e) Result: Thus the program for 16-bit subtraction using 8086 was executed and verified successfully.

36

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 6 (c)


Title of the experiment Date of the experiment : 16 BIT MULTIPLICATION USING 8086 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to multiply two 16-bit numbers using 8086 and store the result in memory.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8086 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. Details of the step 1 Data are brought to 16 bit register. 2 Initialize the address register. 3 The value of AX reg is moved since it is the highest order. 4 Multiply the value of address data. 5 Result will be stored in address 1200. 6 Terminate the program. c) Program: ADDRESS 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C 100D 100E OPCODE A1 00 11 F7 26 02 11 87 16 00 12 A3 02 12 F4 LABEL MNEMONICS MOV AX[1100] MUL [1102] COMMENTS Move the data to accumulator. Use multiply instruction multiply the data

MOV [1200],DX Move the content of DX to location.

MOV[1202],AX

HLT

Terminate the program.

37

DrNNCE

IT/IVSEM

MP&MCLABLM

d) Output: ASCII Array INPUT ADDRESS 1100 1101 1102 1103 e) Result: Thus the program for 16-bit multiplication using 8086 was executed and verified successfully. DATA 24 5A C2 47 Binary (Hexa) Array OUTPUT ADDRESS 1200 1201 1202 1203 DATA 48 4B A4 19

QUESTIONS AND ANSWERS:


1. What is the data and address size in 8086? The 8086 can operate on either 8-bit or 16-bit data. The 8086 uses 20 bit address to access memory and 16-bit address to access 1/0 devices. 2. What are the function of M/IO in 8086. The signal M/IO is used to differentiate memory address and 1/0 address When the processor is accessing memory locations MI 10 is asserted high and when it is accessing 1/0 mapped devices it is asserted low. 3. What are the interrupts of 8086? The interrupts of 8085 are INTR and NMI. The INTR is general maskable interrupt and NMI is non-maskable interrupt. 4. List the segment registers of 8086. The segment registers of 8086 are Code segment, Data segment, Stack segment and Extra segment registers. 5. Define T-State. T-State is defined as one subdivision of the operation performed in one clock period. These subdivisions are internal states synchronized with the system clock, and each T-State is precisely equal to one clock period.

38

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 7 (a)


Title of the experiment Date of the experiment : 8 BIT ADDITION USING 8051 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to add two 8-bit numbers using 8051.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8051 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. Details of the step 1 C reg is to be cleared for carry. 2 Get the data immediately. 3 Add the two data. 4 Store the result in the memory pointer. 5 Terminate the program. c) Program: ADDRESS 4100 4102 4104 4107 4108 OPCODE LABEL 74 05 24 04 90 45 00 F0 80 FE HERE MNEMONICS COMMENTS MOV A,#Data1 Move data1 to A reg. ADD A,#Data2 Add data2 and A reg content MOV DPTR,#4500 Move the data in address to data pointer MOVX @ DPTR,A Move A reg to data pointer SJMP HERE Jump on HERE

d) Output: ASCII Array INPUT ADDRESS 4101 4104 DATA 05 4500 04 09 Binary (Hexa) Array OUTPUT ADDRESS DATA

e) Result: Thus the program for 8-bit addition using 8051 was executed and verified successfully.

39

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 7 (b)


Title of the experiment Date of the experiment : 8 BIT SUBTRACTION USING 8051 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to subtract two 8-bit numbers using 8051.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8051 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. Details of the step 1 C reg is to be cleared for carry. 2 Get the data immediately. 3 Subtract the two data. 4 Store the result in the memory pointer. 5 Terminate the program. c) Program: ADDRESS 4100 4102 4104 4107 4108 OPCODE LABEL 74 05 94 03 90 45 00 F0 80 FE HERE MNEMONICS COMMENTS MOV A,#Data1 Move data1 to A reg. SUBB A,#Data2 Subtract data2 and A reg content MOV DPTR,#4500 Move the data in address to data pointer MOVX @ DPTR,A Move A reg to data pointer SJMP HERE Jump on HERE

d) Output: ASCII Array INPUT ADDRESS 4101 4104 DATA 05 4500 03 02 Binary (Hexa) Array OUTPUT ADDRESS DATA

e) Result: Thus the program for 8-bit subtraction using 8051 was executed and verified successfully.

40

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 7 (c)


Title of the experiment Date of the experiment : 8 BIT MULTIPLICATION USING 8051 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to multiplication two 8-bit numbers using 8051.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8051 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. 1 2 3 Details of the step Get the data in A reg. Get the value to be multiplied in D reg. Multiply the data. The high and low nibble of result is atored in A & B reg. Terminate the program.

c) Program: ADDRESS 4100 4102 4105 4106 4109 410A 410B 410D 410E OPCODE 74 0A 75 F0 88 A4 90 45 00 F0 A3 E5 F0 F0 80 FE LABEL MNEMONICS MOV A,#0A MOV B,#88 MUL A,B MOV DPTR,#4000 MOVX @DPTR,A INC DPTR MOV A,B MOVX @DPTR,A SJMP HERE COMMENTS Data is moved to A reg Data is moved to B erg Multiply data in A,B Initialize memory pointer Move A reg content to immediate DPTR Increment DPTR Move B reg contents to A reg Move A reg content to memory pointer Loop is terminated

HERE

d) Output: ASCII ARRAY - INPUT BINARY (HEXA) ARRAY - OUTPUT ADDRESS DATA ADDRESS DATA 4101 0A 4500 50(LSB) 4104 88 4501 05(MSB) e) Result: Thus the program for 8-bit multiplication using 8051 was executed and verified successfully.

41

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 7 (d)


Title of the experiment Date of the experiment : 8 BIT DIVISION USING 8086 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to division two 8-bit numbers using 8051.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8051 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 Details of the step Get the data in A reg. Get the value to be divided in B reg. Divide the data. The Quotient is in A reg and remainder is in B reg. Terminate the program.

c) Program: ADDRESS 4100 4102 4105 4106 4109 410A 410B 410D 410E OPCODE 74 08 75 84 90 45 00 F0 A3 E5 F0 F0 80 FE LABEL MNEMONICS MOV A,#08 MOV B,#04 DIV A,B MOV DPTR,#4000 MOVX @DPTR,A INC DPTR MOV A,B MOVX @DPTR,A SJMP HERE COMMENTS Data is moved to A reg Data is moved to B erg Divide data in A&B Initialize memory pointer Move A reg content to immediate DPTR Increment DPTR Move B reg contents to A reg Move A reg content to memory pointer Loop is terminated

HERE

42

DrNNCE

IT/IVSEM

MP&MCLABLM

d) Output: ASCII Array INPUT ADDRESS 4101 4104 e) Result: Thus the program for 8-bit division using 8051 was executed and verified successfully. DATA 08 04 Binary (Hexa) Array OUTPUT ADDRESS 4500 4501 DATA 02 00

QUESTIONS AND ANSWERS:


1. What is mean by microcontroller? A device which contains the microprocessor with integrated peripherals like memory, serial ports, parallel ports, timer/counter, interrupt controller, data acquisition interfaces like ADC,DAC is called microcontroller. 2. .Explain the operating mode0 of 8051 serial ports? In this mode serial enters &exits through RXD, TXD outputs the shift clock.8 bits are transmitted/received:8 data bits(LSB first).The baudrate is fixed at 1/12 the oscillator frequency. 3. Explain the interrupts of 8051 microcontroller? The interrupts are: Vector address External interrupt 0 : IE0 : 0003H Timer interrupt 0 : TF0 : 000BH External interrupt 1 : IE1 : 0013H Timer Interrupt 1 : TF1 : 001BH Serial Interrupt Receive interrupt : RI : 0023H Transmit interrupt: TI : 0023H 4. Write a program to find the 2s complement using 8051? MOV A,R0 CPL A INC A 5. List the addressing modes of 8051? Direct addressing Register addressing Register indirect addressing. Implicit addressing Immediate addressing Index addressing Bit addressing 6. Write about CALL statement in 8051? There are two subroutine CALL instructions. They are *LCALL(Long CALL) *ACALL(Absolute CALL) Each increments the PC to the 1st byte of the instruction & pushes them in to the stack.

43

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 8
Title of the experiment Date of the experiment
: KEYBOARD AND DISPLAY INTERFACING USING 8279 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to display the rolling message HELP US in the display.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 3 Facilities Required 8085 Microprocessor Kit 8279 Interface DC Power Supply 5V Quantity 1 1 1

b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 6 7 Details of the step Start the program execution. Initialize the pointer for array. Initialize the counter for P register. Set mode and clear display and increment display counter. The input data given is displayed. The data is moved to the memory. Terminate the program.

c) Program: ADDRESS 4100 4103 4105 4107 4109 410B 410D 410E 4111 4112 4114 4117 4118 4119 OPCODE 21 2C 41 16 0F 3E 10 D3 C2 3E CC D3 C2 3E 90 D3 C2 7E D3 C0 CD 1F 41 23 15 C2 11 41 LABEL START MNEMONICS LXI H,Pointer MVI D,0FH MVI A,10H OUT CNT MVI A,CCH OUT CNT MVI A,90H OUT CNT MOV A,M OUT DAT CALL DELAY INX H DCR D JNZ LOOP
44

COMMENTS Set pointer 412CH Initialize counter Set mode and display Clear display Write display

LOOP

Increment the pointer Decrement the counter Jump if non zero

DrNNCE

IT/IVSEM

MP&MCLABLM

411C 411F 4121 4123 4124 4127 4128 412B 412C 4130 4134 4138

C3 00 41 06 A0 0E FF 0D C2 23 41 05 C2 21 41 C9 FF FF FF FF FF FF FF FF 98 68 11 18 1C 29 FF FF

DELAY LOOP1 LOOP2

JMP START MVI B,0A0H MVI C,0FFH DCR C JNZ LOOP2 DCR B JNZ LOOP1 RET

Display the next character

d) Output:

HELP US
e) Result: Thus the program for 8279 keyboard interfacing was executed and verified successfully. QUESTIONS AND ANSWERS:
1. How a keyboard matrix is formed in keyboard interface using 8279? The return lines, RLo to RL7 of 8279 are used to form the columns of keyboard matrix. In decoded scan the scan lines SLo to SL3 of 8279 are used to form the rows of keyboard matrix. In encoded scan mode, the output lines of external decoder are used as rows of keyboard matrix. 2. What is scanning in keyboard and what is scan time? The process of sending a zero to each row of a keyboard matrix and reading the columns for key actuation is called scanning. The scan time is the time taken by the processor to scan all the rows one by one starting from first row and coming back to the first row again. 3. What are the tasks involved in keyboard interface? The task involved in keyboard interfacing are sensing a key actuation, Debouncing the key and Generating key codes (Decoding the key).These task are performed software if the keyboard is interfaced through ports and they are performed by hardware if the keyboard is interfaced through 8279. 4. What is a programmable peripheral device ? If the functions performed by a peripheral device can be altered or changed by a program instruction then the peripheral device is called programmable device. Usually the programmable devices will have control registers. The device can be programmed by sending control word in the prescribed format to the control register. 5. What is synchronous data transfer scheme? For synchronous data transfer scheme, the processor does not check the readiness of the device after a command have been issued for read/write operation. fu this scheme the processor will request the device to get ready and then read/W1.ite to the device immediately after the request. In some synchronous schemes a small delay is allowed after the request. 6. What is opcode fetch cycle? The opcode fetch cycle is a machine cycle executed to fetch the opcode of an instruction stored in memory. Every instruction starts with opcode fetch machine cycle. 7. What is assembly language? The language in which the mnemonics (short -hand form of instructions) are used to write a program is called assembly language. The manufacturers of microprocessor give the nemonics.

45

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 9(a)


Title of the experiment Date of the experiment : 8255 INTERFACING USING MODE 0 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To initialize port A as the input port A and port B as input in mode 0 to input the data at port A as set by input switches and the output of some data to glow the LED automatically.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. Facilities Required 1 8085 Microprocessor Kit 2 8255 Interface 3 DC Power Supply 5V b) Procedure for doing the experiment: Quantity 1 1 1

Sl.No. Details of the step 1 Start the program execution. Initialize the data A as input. 2 Input the data at port A. Output the data at port B. 3 Terminate the program. c) Program: ADDRESS OPCODE 4100 3E 90 4102 4104 4106 4108 D3 C6 DB C0 D3 C2 76 LABEL MNEMONICS MVI A,90 OUT C6 IN CO OUT C2 HLT COMMENTS Initialize port A as I/P and Port B as output port. Read port A Output the data at port B Terminate the program.

d) Output: INPUT Port A 11101001 OUTPUT Port B 11101001

e) Result: Thus the interfacing 8255 using Mode 0 was executed and verified successfully.

QUESTIONS AND ANSWERS:


1. What is conversion time? The time required for conversion of analog signal into its digital equivalent is called conversion time.

46

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 9(b)


Title of the experiment Date of the experiment : 8255 INTERFACING USING MODE 1
:

OBJECTIVE (AIM) OF THE EXPERIMENT


To initialize port A as the input port C and output port B in mode 1 to input the data at port A as sort by SPDT switches and output data in process.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. Facilities Required 1 8085 Microprocessor Kit 2 8255 Interface 3 DC Power Supply 5V b) Procedure for doing the experiment: Sl.No. 1 2 3 Quantity 1 1 1

Details of the step Start the program execution. Initialize the data A as input. Input the data at port A. Output the data at processor. Terminate the program.

c) Program: ADDRESS 4200 4202 4204 4206 4209 OPCODE 3E 90 D3 C6 DB C0 32 00 45 76 LABEL MNEMONICS MVI A,90 OUT C6 IN CO OUT C2 HLT COMMENTS Initialize port A as I/P. Read port A Output the data at 4500 Terminate the program.

d) Output: INPUT Port A 01010101 OUTPUT DISPLAY 55

e) Result: Thus the interfacing 8255 using Mode 1 was executed and verified successfully.

QUESTIONS AND ANSWERS:


1. What is the necessacity of the programmable interval timer? It is necessary to generate accurate time delats in a micro computer system. Counters and be programmed in 6 different modes for varions applicaions. 2. What is resolution? The ratio of the change in output voltage resulting from a change of one LSB at the digital input is called resolution.

47

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 9(c)


Title of the experiment Date of the experiment : 8255 INTERFACING USING MODE 2 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To initialize the processor as input and port as output port and output the data at port C.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. Facilities Required 1 8085 Microprocessor Kit 2 8255 Interface 3 DC Power Supply 5V b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 Details of the step Start the program execution. Initialize the input through processor. Input the data and processor. Output the data at port C. Terminate the program. Quantity 1 1 1

c) Program: ADDRESS 4300 4302 4304 4306 4308 OPCODE 3E 90 D3 C6 3E 06 D3 C4 76 LABEL MNEMONICS MVI A,90 OUT C6 MVI A,01 OUT C4 HLT COMMENTS Initialize port A as output. Out the value of C6. Set the output C0 bits as port. Output the value of C4. Terminate the program.

d) Output: 4105 Port C A 1010 B 1011

e) Result: Thus the interfacing 8255 using Mode 2 was executed and verified successfully.

QUESTIONS AND ANSWERS:


1. What are the internal devices of 8255 ? The internal devices of 8255 are port-A, port-B and port-C. The ports can be programmed for either input or output function in different operating modes.

2. Name the modes available in 8255 A control word format. a. BSR mode b.I/O mode mode 0 , mode 1, mode 2
48

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 10
Title of the experiment Date of the experiment : ADC INTERFACING :

OBJECTIVE (AIM) OF THE EXPERIMENT


To initialize the analog to digital conversion process by means of software and to execute the program which converts the analog input at channel and displays the output through the LED.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8085 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 6 Details of the step Move immediately the value of accumulator output. Move immediately as another value of accumulator. EX-OR the value for 3 times. Initialize A reg as 00. Get the output at 00. Terminate the program.

c) Program: ADDRESS 4100 4102 4104 4106 4108 410A 410C 410D 410E 410F 4111 4113 OPCODE 3E 10 D3 C8 3E 18 D3 C8 CE 01 D3 D0 AF AF AF 3E 00 D3 D0 76 LABEL START MNEMONICS MVI A,10 OUT 0C8H MVI A,18 OUT 0C8H MVI A,01 OUT 0D0H XRA A XRA A XRA A MVI A,00 OUT 000H HLT COMMENTS Select channel 0 and make ALE low. Make ALE high. Soc signal high Delay

Soc signal low Terminate the program.

49

DrNNCE

IT/IVSEM

MP&MCLABLM

d) Output: Analog Voltage 0V 1.3V 1.66V 2.17V 2.68V 3.45V 4.09V 4.66V e) Result: Thus the ADC interfacing program was executed and verified successfully. Digital Voltage 0000 0000 0010 1001 0001 1110 0111 1010 0010 1001 0111 1101 1100 0111 1111 1111 Digital Data 00 29 1A 7F 29 7B C7 FF

QUESTIONS AND ANSWERS:


1. Name any two types of ADC. a. Dual slope ADC b. Flash type ADC 2. Which is the fastest ADC and why? Flash type ADC is the fastest of all ADCs. Flash ADC has parallel comparator and the conversion speed is accomplished by providing 2 n-1. Comparators and simultaneously comparing the input signal with unique reference levels spaced one LSB apart. 3. What is ADC? ADC Analog to digital converter.
4. Write about the jump statement? There are three forms of jump. They are LJMP(Long jump)-address 16 address 11 SJMP(Short Jump)-relative address AJMP(Absolute Jump)-

5. Define machine cycle. Machine cycle is defined as the time required to complete one operation of accessing memory, I/O, or acknowledging an external request. This cycle may consist of three to six T-states.

50

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 11(a)


Title of the experiment Date of the experiment
: a) DAC INTERFACING SQUARE WAVE GENERATION :

OBJECTIVE (AIM) OF THE EXPERIMENT


To generate the square wave at the DAC output.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. Facilities Required 1 8085 Microprocessor Kit 2 DC Power Supply 5V b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 6 Quantity 1 1

Details of the step Load the initial value (00) to Accumulator and move it to DAC. Call the delay program. Load the final value (FF) to accumulator and move it to DAC. Call the delay program. Repeat the steps 2 and 4 Terminate the program.

c) Program: ADDRESS 4100 4102 4104 4107 4109 410B 410E 4111 4113 4115 4116 4119 411A 411D OPCODE 3E 00 D3 C8 CD 11 41 3E 77 D3 C8 CD 11 41 C3 00 41 06 05 0E FF 0D C2 15 41 05 C2 13 41 C9 LABEL START MNEMONICS MVI A,00 OUT 0C8H CALL DELAY MVI ,0FF OUT 0C84 CALL DELAY JMP START MVI B,05 MVI C,0FF DCR C JNZ L2 DCR B JNZ L1 RET COMMENTS Move 00 to A reg. To call the delay signal Move the 0FF to A reg To call the delay signal To jump to START signal Move 05 to B reg Move 0FF to C reg Decrement C reg Jump loop2 Decrement B reg Jump loop1 Return

DELAY LI L2

51

DrNNCE

IT/IVSEM Amp

MP&MCLABLM

d) Output:

Time

Amplitude 10V

Time 60ms

e) Result: Thus the program for square wave generation was executed and verified successfully.

QUESTIONS AND ANSWERS:


1. What are the commonly used DAC? a. R/2R ladder DAC b. Weighted resister DAC c. Inverted R/2R ladder DAC 2. Define accuracy. A comparison of actual output voltage with expected output is called accuracy. 3. Define monotonicity. A converter is said to have good monotonicity if it does not miss any step backward when stepped through its entire range by a counter.

52

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 11(b)


Title of the experiment Date of the experiment
: DAC INTERFACING SAWTOOTH WAVE GENERATION :

OBJECTIVE (AIM) OF THE EXPERIMENT


To generate the sawtooth wave at the output of DAC1.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. Facilities Required Quantity 1 8085 Microprocessor Kit 1 2 DC Power Supply 5V 1 b) Procedure for doing the experiment: Sl.No. Details of the step 1 Load the initial value (00) to Accumulator and move it to DAC. 2 Move the accumulator content of DAC. 3 Increment the accumulator content by 1. Repeat the steps 2 and 3 4 Terminate the program. c) Program: ADDRESS 4100 4102 4104 4105 4108 OPCODE 3E 00 D3 C0 3C C2 02 41 C3 00 41
Amp

LABEL START L1

MNEMONICS MVI A,00 OUT 0C0H INR A JNZ L1 JMP START

COMMENTS Move 00 to A reg.

Jump to L1 Jump to START

d) Output:

Time

Amplitude 10V

Time 60ms

e) Result: Thus the program for sawtooth wave generation was executed and verified successfully.

53

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 11(c)


Title of the experiment Date of the experiment
: DAC INTERFACING TRIANGULAR WAVE GENERATION :

OBJECTIVE (AIM) OF THE EXPERIMENT


To generate the triangular wave at the output of DAC2.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8085 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. Details of the step 1 Load the initial value (00) to Accumulator and move it to DAC. 2 Move the accumulator content of DAC. 3 Increment the accumulator content by 1. 4 If accumulator content is Zero, proceed to next step else goto step 3. 5 Load the value (FF) to accumulator. 6 Move the accumulator content of DAC. 7 Decrement the accumulator content by 1. 8 If Accumulator content is zero goto to step 2 else goto step 7 9 Terminate the program. c) Program: ADDRESS 4100 4102 4103 4105 4106 4109 410B 410C 410E 410F 4112 OPCODE 2E 00 7D D3 C8 2C C2 02 41 2F FF 7D D3 C8 2D C2 0B 41 C3 00 41 LABEL START L1 MNEMONICS MVI L,00 MOV A,L OUT C8H INR L JNZ L1 MVI L,0FFH MOV A,L OUT C8H DCR L JNZ L2 JMP START COMMENTS Move 00 to L reg. Move L reg to A reg

L2

If ZF=0, gato LOOP1 Move 0FFH to L reg Move L reg to A reg Decrement the L reg pair If ZF=0, gato step 2 Jump to START

d) Output:

Amp 54

DrNNCE

IT/IVSEM

MP&MCLABLM

Time

Amplitude 10V

Time 60ms

Analog Voltage in Volts(V)

Digital Output MSB 0000 0010 0011 0011 0011 0111 0111 1100 1100 1111 LSB 0000 0010 1011 1011 0001 1001 0001 1011 0011 1111

Decimal

0 0 0.02 3A 1.08 59 1.67 59 2.51 113 2.56 113 3.21 118 3.60 203 4.15 227 4.67 255 e) Result: Thus the program for triangular wave generation was executed and verified successfully.

QUESTIONS AND ANSWERS:


1. What is the difference between CPU bus and system bus? The CPU bus has multiplexed lines but the system bus has separate lines for each signal. (The multiplexed CPU lines are demultiplexed by the CPU interface circuit to form system bus). 2. How clock signal is generated in 8086? What is the maximum internal clock frequency of 8086? The 8086 does not have on-chip clock generation circuit. Hence the clock generator chip, 8284 is connected to the CLK pin of8086. The clock signal supplied by 8284 is divided by three for internal use. The maximum internal clock frequency of8086 is 5MHz.

55

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 12(a)


Title of the experiment Date of the experiment : STEPPER MOTOR INTERFACING WITH 8051 :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to rotate the motor in forward and reverse direction using 8051.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 3 Facilities Required 8051 Microprocessor Kit 8279 interfacing Kit DC Power Supply 5V Quantity 1 1 1

b) Procedure for doing the experiment: Sl.No. 1 2 3 4 5 Details of the step Start the program. The port and 8279 are initiated. Set the count for 4-stepping sequence. Call subroutine wait for 1ms. Decrement the counter. Count zero is checked then set the count for 4-stepping sequence else goto initializing ports. Terminate the program.

c) Program: ADDRESS 4100 4102 4105 4106 4108 410A 410D 410F 4112 4115 4117 411A 411C 411E 411F 4121 OPCODE 7C 33 90 41 44 12 41 1C DC 78 12 41 3B 7C 33 90 41 48 12 41 1C DC 78 12 41 3B 80 E4 78 04 E0 CD 83 C0 82 LABEL START L2 MNEMONICS MOV V4,#33H MOV DPTR # FORWARD LCALL L1 DJNZ R4,L2 LCALL DELAY MOV DPTR #REVERSE LCALL L1 MOV R4,#33H DJNZ R4,L3 LCALL DELAY SJMP START MOV R0,#04 PUSH DPH PUSH DCH MOV DPTR,#FF
56

COMMENTS Initialize count Initialize pointer Excitation Long jump to loop1 Decrement R4 Initialize count Long call loop1 Move 33H to R4 Decrement R4 Wait for subroutine Short jump to start Move 04 to reg R0

L3

L1 LOOP

Move FF data to DPTR

DrNNCE

IT/IVSEM

MP&MCLABLM

4123 4126 4128 412A 412C 412E 4130 4132 4133 4135 4137 4138 413A 413B 413D 413F 4141 4143 4144 4145 d) Output:

90 FF C0 7A 04 79 05 7B FF DB FE D9 FA DA 16 F0 00 82 D0 83 D8 E4 22 22 7D 01 7A 05 DA FF DD FA 22 D9 05 06 0A 0A 06 05 09

L7 L6 L4

DELAY L9 L8 Forward Reverse

MOV DPTR,#FF MOV R2,#04 MOV R1,#05 MOV R3,#FF DJNZ R3,L4 DJNZ R1,L6 DJNZ R2,L7 MOVX@DPTR,A POP DLH POP DPH INC DPTR DJNZ R0,LOOP RET MOV R5,#01 MOV R2,#05 DJNZ R2,L8 DJNZ R5,L9 RET D9 05 06 0A 0A 06 05 09

Move 04 to reg R2 Move FF to reg R3 Decrement R3 goto L4 Decrement R1 goto L6 Decrement R2 goto L7 Move A to DPTR Decrement DLH Increment pointer

Move 01 to reg R5 Move 05 to reg R2 Decrement R2 Decrement R5

Clockwise direction Address Data

Anti-Clockwise Direction Address Data

4144 09 4148 0A 4145 05 4149 06 4146 06 414A 05 4147 0A 414B 09 e) Result: Thus the program to rotate stepper motor was executed and verified successfully.

QUESTIONS AND ANSWERS:


1. Write the flags of 8086. The 8086 has nine flags and they are 1. Carry Flag (CF) 2. Overflow Flag (OF) 3. Parity Flag (PF) 4. Trace Flag (TF) 5. Auxiliary carry Flag (AF) 6. Interrupt Flag (IF) 7. Zero Flag (ZF) 8. Direction Flag (DF) 9. Sign Flag (SF) 2. Write the special functions carried by the general purpose registers of 8086. The special functions carried by the registers of 8086 are the following. Register Special function 1. AX 16-bit Accumulator 2. AL 8-bit Accumulator 3. BX Base Register 4. CX Count Register 5. DX .Data Register

57

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 12(b)


Title of the experiment Date of the experiment : INTERFACING 8051 WITH DC MOTOR :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to control the speed of DC motor using 8051.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8051 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. Details of the step 1 Start the program. Store the 8-bit data into the accumulator. 2 Initialize the counter. Move the content of accumulator to the data pointer. 3 Terminate the program. c) Program:
ADDRESS OPCODE MNEMONICS COMMENTS

4500 4502 4505 4506

74 FF 90 FF C0 F0 80 FF

MOV A, #FF MOV DPTR,#FF10H MOVX @DPTR,A SIMPL

Move FF into accumulator Load the value FF 10H into the data pointer Move the data content to the accumulator Instruction is executed.

d) Output: A Reg FF 7F 55 Speed High Medium Low Accumalator 5V 3V 2V

e) Result: Thus the program to control the speed of DC motor was executed and verified successfully. QUESTIONS AND ANSWERS: 1. What are the functional units available in 8086 architecture? The bus interface unit and execution unit are the two functional units available in 8086 architecture. 2. What is assembly language? The language in which the mnemonics (short -hand form of instructions) are used to write a program is called assembly language. The manufacturers of microprocessor give the mnemonics.

58

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 13
Title of the experiment Date of the experiment : Program to find square and cube of a number :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to find square and cube of a number using 8086.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8086 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. Details of the step 1 Start the program. Store the 16-bit data into the accumulator. 2 Initialize the counter. Move the content of accumulator to the data pointer. 3 Terminate the program. c) Program:
ADDRESS OPCODE MNEMONICS COMMENTS

4500

MOV AX,DATA MOV DS,AX MOV AX,X MOV BX,X MUL BX MOV SQUARE,AX MUL BX MOV CUBE,AX MOV AH,4CH INT 21H

Load the Data to AX. Move the Data AX to DS. Move the X number Data to AX. Move the X number Data to BX. Perform the multiplication by BX. Store value in SQUARE. Perform the multiplication by BX. Store value in CUBE.

d) Output: Square Cube Input 4h 4h Output 10h 40h

e) Result: Thus the program to find square and cube of a given number using 8086 sucessfully. QUESTIONS AND ANSWERS: 1. What are the functional units available in 8086 architecture? The bus interface unit and execution unit are the two functional units available in 8086 architecture.
59

DrNNCE

IT/IVSEM

MP&MCLABLM

Experiment Number: 14
Title of the experiment Date of the experiment : Program to find LCM of a given number :

OBJECTIVE (AIM) OF THE EXPERIMENT


To write an assembly language program to find LCM of a given number using 8086.

FACILITIES REQUIRED AND PROCEDURE


a) Facilities required to do the experiment: Sl.No. 1 2 Facilities Required 8086 Microprocessor Kit DC Power Supply 5V Quantity 1 1

b) Procedure for doing the experiment: Sl.No. Details of the step 1 Start the program. Store the 16-bit data into the accumulator. 2 Initialize the counter. Move the content of accumulator to the data pointer. 3 Terminate the program. c) Program:
ADDRESS OPCODE MNEMONICS COMMENTS

4500

START: MOV AX,DATA MOV DS,AX MOV DX,0H MOV AX,NUM MOV BX,NUM+2 UP: PUSH AX PUSH DX DIV BX CMP DX,0 JE EXIT POP DX POP AX ADD AX,NUM JNC DOWN INC DX DOWN: JMP UP EXIT: POP LCM+2 POP LCM MOV AH,4CH INT 21H CODE ENDS END START

Load the Data to AX. Move the Data AX to DS. Initialize the DX. Move the first number to AX. Move the second number to BX. Store the quotient/first number in AX. Store the remainder value in DX. Divide the first number by second number. Compare the remainder. If remainder is zero, go to EXIT label. If remainder is non-zero, Retrieve the remainder. Retrieve the quotient. Add first number with AX. If no carry jump to DOWN label. Increment DX. Jump to Up label. If remainder is zero, store the value at LCM+2.

60

DrNNCE

IT/IVSEM

MP&MCLABLM

d) Output: Input 0A, 04 Output 02

e) Result: Thus the program to find LCM of a given number using 8086 sucessfully.

QUESTIONS AND ANSWERS:


1. What is assembly language? The language in which the mnemonics (short -hand form of instructions) are used to write a program is called assembly language. The manufacturers of microprocessor give the mnemonics.

61

You might also like