61
Dr NNCE IT / IVSEM MP&MC LABLM 1 CS2259-MICROPROCESSOR AND MICROCONTROLLER LABORATORY LABORATORY MANUAL FOR IV SEMESTER B.TECH / IT ACADEMIC YEAR: 2012 - 2013 (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.

CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Embed Size (px)

Citation preview

Page 1: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

CS2259-MICROPROCESSOR AND MICROCONTROLLER

LABORATORY

LLAABBOORRAATTOORRYY MMAANNUUAALL

FFOORR IIVV SSEEMMEESSTTEERR BB..TTEECCHH // IITT

AACCAADDEEMMIICC YYEEAARR:: 22001122 -- 22001133

((FFOORR PPRRIIVVAATTEE CCIIRRCCUULLAATTIIOONN OONNLLYY))

AANNNNAA UUNNIIVVEERRSSIITTYY,, CCHHEENNNNAAII..  

 

 

 

 

 

NAME :…………………………………………

REG.NO :…………………………………………

BATCH :…………………………………………

 

 

  

  

DEPARTMENT OF INFORMATION TECHNOLOGY

DR.NAVALAR NEDUNCHEZHIAYN COLLEGE OF ENGINEERING,

THOLUDUR-606303, CUDDALORE DIST.

Page 2: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

GENERAL INSTRUCTIONS FOR LABORATORY CLASSES

DO’S

o Without Prior permission do not enter into the Laboratory.

o While entering into the LAB students should wear their ID cards.

o The Students should come with proper uniform.

o Students should sign in the LOGIN REGISTER before entering into the laboratory.

o Students should come with observation and record note book to the laboratory.

o Students should maintain silence inside the laboratory.

o After completing the laboratory exercise, make sure to shutdown the system properly.

DONT’S

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.

Page 3: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

HARDWARE REQUIREMENTS:

Microprocessor 8085,8086,8051 Kit

UNIVERSITY PRACTICAL EXAMINATION ALLOTMENT OF MARKS

INTERNAL ASSESMENT : 20 MARKS

PRACTICAL ASSESMENT : 80 MARKS

TOTAL : 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 : 3 MARKS

RECORD NOTE : 7 MARKS

MODEL EXAM : 5 MARKS

ATTENDANCE : 5 MARKS

TOTAL : 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 : 10 MARKS

ALGORITHM & FLOWCHART : 20 MARKS

PROGRAM : 30 MARKS

EXECUTION : 30 MARKS

VIVA VOCE : 10 MARKS

TOTAL : 100 MARKS

Page 4: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

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

Page 5: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

CONTENTS

Ex. No Name of the Experiment

Page

No.

1. Programs for 8-bit arithmetic operations using 8085 5

2. Programs for 16-bit arithmetic operations using 8085. 13

3. Programs for sorting and searching operations using 8085. 20

4. Programs for sorting and searching operations using 8086. 26

5. Programs for string manipulation operations using 8086. 31

6. Interfacing ADC and DAC. 40

7. Parallel communication between two microprocessor kits using Mode 1 and Mode2 of 8255. 46

8. Interfacing and programming 8279 54

9. Programming using arithmetic, logical and bit manipulation instructions of 8051 microcontroller. 57

10. Serial communication between two microprocessor kits using 8251 63

11. Interfacing and programming 8253 65

12. Interfacing and programming of stepper motor and DC motor speed control 72

Beyond the Syllabus 13 Arithmetic programs to find square and cube 58 14 Program to find LCM of a given number 59

         

 

 

 

Page 6: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

 Experiment Number: 1 (a)

Title of the experiment : 8 – BIT ADDITION USING 8085

Date of the experiment :

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 LABEL MNEMONICS COMMENTS 4100 3A 00 42 LDA 4200H Get first data in A 4103 47 MOV B,A Move A to B 4104 3A 01 42 LDA 4201H Get second data in A 4107 0E 00 MVI C00H Clear C register to account for carry 4109 80 ADD B Get Sum in A reg 410A D2 0E 41 JNC AHEAD If CY=0 go to AHEAD 410D 0C INR C If CY=1 increment C reg 410E 32 02 42 AHEAD STA 4202H Store the sum in memory 4111 79 MOV A,C Move C to A 4112 32 03 42 STA 4203H Store the carry in memory 4115 76 HLT Terminate the program d) Output:

INPUT OUTPUT ADDRESS DATA ADDRESS DATA

4200 E2 4202 27 4201 E5 4203 01

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

Page 7: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

 Experiment Number: 1 (b)

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

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. 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 subtrahend(data to be subtracted) from the memory to accumulator and move into B Register.

2 Load the minuend from memory to accumulator. 3 Clear C register to account for sign of the result. 4 Subtract the content of B register from the content of accumulator. 5 Check for carry, if carry 1 go to step 6 else if carry 0 go to step 7. 6 Increment C register, complement the accumulator and add 01H. 7 Store the difference to memory. 8 Move the content of C register to accumulator and store in memory 9 Terminate the program

c) Program:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS 4100 3A 01 42 LDA 4201H Get the subtrahend in B reg 4103 47 MOV B,A Move A to B 4104 3A 00 42 LDA 4200H Get the minuend in A reg 4107 0E 00 MVI C00H Clear C register to account for sign 4109 90 SUB B Get Difference in A reg 410A D2 11 41 JNC AHEAD If CY=0 go to AHEAD 410D 0C INR C If CY=1 increment C reg 410E 2F CMA Get 2’s complement of difference 410F C6 01 ADI 10H Result in A reg 4111 32 02 42 AHEAD STA 4202H Store the sum in memory 4114 79 MOV A,C Move C to A 4115 32 03 42 STA 4203H Store the sign bit in memory 4118 76 HLT Terminate the program

Page 8: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

d) Output:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

4200 5E 4202 2A

4201 3A 4203 00

e) Result:

Thus the program for 8-bit Subtraction was implemented and verified successfully.

Page 9: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

Experiment Number: 1 (c)

Title of the experiment : 8 – BIT MULTIPLICATION USING 8085

Date of the experiment :

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. 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 address of the first data in HL pair. 2 Clear C register for overflow. 3 Clear the accumulator. 4 Move the first data to B register. 5 Increment the pointer. 6 Move the second data to D register. 7 Add the content of D register to accumulator. 8 Check for carry, If carry=1 go to step 9 else carry=0 go to step 10. 9 Increment the C register.

10 Decrement the B register. 11 Check whether count has reached zero. If ZF=0, repeat steps7 through 11 or of

ZF=1 go to next step. 12 Terminate the program.

c) Program:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS 4100 21 00 42 LXI 4200H Set pointer for data 4103 0E 00 MVI C00H Clear C to account for

overflow 4105 AF XRA A Clear accumulator 4106 46 MOV B,M Get first data in B reg 4107 23 INX H 4108 56 MOV D,M Get second data in D reg 4109 82 REPT ADD D Add D reg to accumulator 410A D2 0E 41 JNC AHEAD 410D 0C INR C If CY=1 increment C reg

Page 10: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

10 

ADDRESS OPCODE LABEL MNEMONICS COMMENTS 410E 05 AHEAD DCR B 410F C2 09 41 JNC REPT Repeat addition until ZF=1 4112 23 INX H 4113 77 MOV M,A Store lower byte of product

in memory 4114 23 INX H 4115 71 MOV M,C Store higher byte of product

in memory 4116 76 HLT Terminate the program

 

 

d) Output:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

4200 07 4202 86

4201 4A 4203 39

e) Result:

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

Page 11: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

11 

Experiment Number: 1 (d)

Title of the experiment : 8 – BIT DIVISION USING 8085

Date of the experiment :

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. 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 divisor in accumulator and move it to B reg. 2 Load the dividend in accumulator. 3 Clear C-Register to account for quotient. 4 Check whether divisor is less than dividend. If divisor is less than dividend, go

to step 8 otherwise go to next step. 5 Subtract the content of B reg from accumulator. 6 Increment the content of C reg, go to step 4. 7 Store the content of accumulator in memory. 8 Move the content of C reg to accumulator and store in memory. 9 Terminate the program.

c) Program:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS 4100 3A 01 42 LDA 4201H 4103 47 MOV B,A Get the divisor in B reg 4104 3A 00 42 LDA 4200H Get the dividend in A reg 4107 0E 00 MVI C00H Clear C reg for Quotient 4109 B8 AGAIN CMP B 410A DA 12 41 JC STORE If divisor is less than dividend go to STORE 410D 90 SUB B Subtract divisor from dividend 410E 0C INR C Increment quotient by 1 for each subtraction 410F C3 09 41 JMP AGAIN 4112 32 03 42 STORE STA 4203H Store the remainder in memory 4115 79 MOV A,C 4116 32 02 42 STA 4202H Store the quotient in memory 4119 76 HLT

Page 12: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

12 

d) Output:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

4200 C9 4202 14

4201 0A 4203 01

e) Result:

Thus the program for 8-bit Division was implemented and verified successfully.

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.

Page 13: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

13 

Experiment Number: 2 (a)

Title of the experiment : 16 – BIT ADDITION USING 8085

Date of the experiment :

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. 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 in HL register pair. 2 Move the first data to DE reg pair. 3 Load the second data in HL reg pair. 4 Clear A reg for carry. 5 Add the content of DE pair to HL pair. 6 Check for carry. If CARRY=1, go to step 7 or if CARRY=0, go to step 8. 7 Increment A reg to account for carry. 8 Store the sum and carry in memory. 9 Terminate the program.

c) Program:

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

Page 14: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

14 

d) Output:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

4200 54 4204 E6

4201 C2 4205 4C

4202 92 4206 01

4203 8A 4207 -

e) Result:

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

Page 15: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

15 

 Experiment Number: 2 (b)

Title of the experiment : 16 – BIT SUBTRACTION USING 8085

Date of the experiment :

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. 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 low byte of subtrahend in accumulator from memory and move it to the B reg.

2 Load the low byte of minuend in accumulator from memory. 3 Subtract the content of B reg from the content of Accumulator. 4 Store the low byte of result in memory. 5 Load the high byte of subtrahend in accumulator from memory and move it to B

reg. 6 Load the high byte of minuend in accumulator from memory. 7 Subtract the content of B reg and the carry from the content of Accumulator. 8 Store the high byte of result in memory. 9 Terminate the program.

c) Program:

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

Page 16: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

16 

d) Output:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

4200 Ab 4204 7F

4201 B2 4205 20

4202 2c - -

4203 92 - -

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

Page 17: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

17 

Experiment Number: 2 (c)

Title of the experiment : 16 – BIT MULTIPLICATION USING 8085

Date of the experiment :

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. 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 in HL register pair and move to SP. 2 Load the second data in HL register pair and move to DE. 3 Clear HL pair. 4 Clear BC pair for overflow. 5 Add the content of SP pair to HL pair. 6 Check for carry. If CARRY=1, go to step 7 or if CARRY=0, go to step 8. 7 Increment BC pair . 8 Decrement the count. 9 Check whether count has reached zero.

10 To check for zero of the count, move the content of E reg to A reg and logically or with D reg.

11 Check the zero flag if ZF=0 repeat step 5 through 11 or if ZF=1 goto next step. 12 Store the content of HL in memory. 13 Move the content of C to L and B to H and store HL in memory. 14 Terminate the program.

c) Program:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS 4100 2A 00 42 LHLD 4200H Get first data in HL pair 4103 F9 SPHL Save first data in SP pair 4104 2A 02 42 LHLD 4202H Get second data in HL pair 4107 EB XCHG Save Second data in DE pair 4108 21 00 00 LXIH 0000H Clear HLpair(initial sum=0) 410B 01 00 00 LXIB 0000H Clear BC pair to account overflow 410E 39 NEXT DAD SP Add the content of SP to sum(HL)

Page 18: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

18 

410F 02 13 41 JNC AHEAD 4112 03 INX B If CY=1,increment BC pair. 4113 1B AHEAD DCX D 4114 7B MOV A,E Check for zero in DE pair this is done

logically. 4115 B2 ORA D OR D and E 4116 C2 0E 41 JNZ NEXT Repeat addition until count is zero 4119 22 04 42 SHLD 4204H Store lower 16 bit of product in memory 411C 69 MOV L,C 411D 60 MOV H,B 411E 22 06 42 SHLD 4206H Store upper 16 bit of product in memory 4121 76 HLT Terminate the program.

d) Output:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

4200 24 4204 48

4201 5A 4205 4B

4202 C2 4206 44

4203 47 4207 19

e) Result:

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

Page 19: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

19 

 Experiment Number: 3 (a)

Title of the experiment : ASCENDING ORDER USING 8085

Date of the experiment :

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. 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 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 set 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 LABEL MNEMONICS COMMENTS 4100 3A 00 42 LDA 4200H load the count value in A reg

4103 47 MOV B,A Set count for N-1 repetition 4104 05 DCR B 4105 21 00 42 LOOP2 LXIH 4200H Set pointer for array 4108 4E MOV C,M Set count for N-1 comparison 4109 0D DCR C 410A 23 INX H Increment pointer 410B 7E LOOP1 MOV A,M Get one data of array in A 410C 23 INX H 410D BE CMP M Compare next data with A reg 410E DA 16 41 JC AHEAD If content of A is less than memory then

goto AHEAD 4111 56 MOV D,M If the content A is greater than the content

Page 20: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

20 

of memory, then exchange content of memory pointed by HL and previous location

4112 77 MOV M,A 4113 2B DCX H 4114 72 MOV M,D 4115 23 INX H 4116 0D AHEAD DCR C 4117 C2 0B 41 JNZ LOOP1 Repeat comparison until count is zero 411A 05 DCR B 411B C2 05 41 JNZ LOOP2 Repeat N-1 comparison until B count is

zero. 411E 76 HLT Terminate the program.

d) Output:

INPUT OUTPUT ADDRESS DATA ADDRESS DATA

4200 07 4200 07 4201 AB 4201 34

4202 92 4202 4F

4203 84 4203 69

4204 4F 4204 84

4205 69 4205 92

4206 F2 4206 AB

4207 34 4207 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.

Page 21: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

21 

Experiment Number: 3 (b)

Title of the experiment : Descending Order using 8085

Date of the experiment :

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. 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 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 LABEL MNEMONICS COMMENTS 4100 3A 00 42 LDA 4200H load the count value in A reg

4103 47 MOV B,A Set count for N-1 repetition 4104 05 DCR B 4105 21 00 42 LOOP2 LXIH 4200H Set pointer for array 4108 4E MOV C,M Set count for N-1 comparison 4109 0D DCR C 410A 23 INX H Increment pointer 410B 7E LOOP1 MOV A,M Get one data of array in A 410C 23 INX H 410D BE CMP M Compare next data with A reg 410E D2 16 41 JC AHEAD If content of A is greater than memory then

goto AHEAD 4111 56 MOV D,M If the content A is less than the content of

memory, then exchange content of memory pointed by HL and previous location

Page 22: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

22 

4112 77 MOV M,A 4113 2B DCX H 4114 72 MOV M,A 4115 23 INX H 4116 0D AHEAD DCR C 4117 C2 0B 41 JNZ LOOP1 Repeat comparison until count is zero 411A 05 DCR B 411B C2 05 41 JNZ LOOP2 Repeat N-1 comparison until B count is zero.411E 76 HLT Terminate the program.

d) Output:

INPUT OUTPUT ADDRESS DATA ADDRESS DATA

4200 07 4200 07 4201 C4 4201 F4 4202 84 4202 E2 4203 9A 4203 C4 4204 7B 4204 B2 4205 E2 4205 9A 4206 F4 4206 84 4207 B2 4207 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.

Page 23: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

23 

Experiment Number: 4 (a)

Title of the experiment : Searching - Largest Data

Date of the experiment :

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. 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 address first element of array in HL reg pair. 2 Move the count of B reg. 3 Increment the pointer. 4 Get the first data in A reg. 5 Decrement the count. 6 Increment the pointer. 7 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. 8 Decrement the count. 9 If ZF=0, goto step 6 or if ZF=1 goto next step.

10 Goto large data. 11 Terminate the program.

c) Program:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS 4100 21 00 42 LXIH 4200H Set Pointer for array

4103 46 MOV B,M Set count for no of element in array 4104 23 INX H 4105 7E MOV A,M Set first element of array as large data

4106 05 DCR B Decrement the count

4107 23 LOOP INX H 4108 BE CMP M Compare an element of array with current

largest data 4109 02 00 41 JNC AHEAD If CY=0, goto AHEAD

410C 7E MOV A,M If CY=1, then content of memory is larger than accumulator. Hence If CY=1, make

Page 24: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

24 

memory content as current largest by moving it to A reg

410D 05 AHEAD DCR B 410E C2 07 41 JNZ LOOP Repeat comparison until count is zero 4111 32 00 42 STA 4300H Store the large data in memory 4114 76 HLT Terminate the program

d) Output:

INPUT OUTPUT ADDRESS DATA ADDRESS DATA

4200 07

4300 FC

4201 62

4202 7D

4203 FC

4204 24

4205 C2

4206 0F

4207 92

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 .

Page 25: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

25 

Experiment Number: 4 (b)

Title of the experiment : SEARCHING - SMALLEST DATA

Date of the experiment :

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. 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 address first element of array in HL reg pair. 2 Move the count of B reg. 3 Increment the pointer. 4 Get the first data in A reg. 5 Decrement the count. 6 Increment the pointer. 7 Compare the content of HL pair with A reg, If CY=1, goto step 10 elseto step 9 8 Move the content of memory address by HL to A reg. 9 Decrement the count.

10 If ZF=0, goto step 6 or if ZF=1 goto next step. 11 Store the smallest data in memory. 12 Terminate the program.

c) Program:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS 4100 21 00 42 LXIH 4200H Set Pointer for array

4103 46 MOV B,M Set count for no of element in array 4104 23 INX H 4105 7E MOV A,M Set first element of array as smallest data

4106 05 DCR B Decrement the count

4107 23 LOOP INX H 4108 BE CMP M Compare an element of array with current

smallest data 4109 DA 0D 41 JC AHEAD If CY=1, goto AHEAD

Page 26: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

26 

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

410D 05 AHEAD DCR B 410E C2 07 41 JNZ LOOP Repeat comparison until count is zero 4111 32 00 42 STA 4300H Store the small data in memory 4114 76 HLT Terminate the program

d) Output:

INPUT OUTPUT ADDRESS DATA ADDRESS DATA

4200 07

4300 1C

4201 42

4202 3A

4203 1C

4204 24

4205 B4

4206 25

4207 4F

e) Result:

Thus the program to find the smallest data in an array is constructed and verified successfully.

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.

Page 27: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

27 

 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. 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 Get the BCD data in A reg and save in E reg. 2 Mark the lowest nibble (units) of the BCD data in A reg. 3 Rotate the upper nibble to lower nibble position and save in B reg. 4 Clear the accumulator. 5 Move 0AH to C reg. 6 Decrement C reg. If ZF=0,gato step 6 else ZF=1, goto next step. 7 Save the product in B reg. 8 Get the BCD data in A reg from E reg and mark the upper nibble. 9 Add the content of A reg to product (B reg).

10 Store the binary value(A reg). 11 Terminate the program.

c) Program:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS 4100 3A 00 42 LDA 4200H Get the data in D reg and save in E reg

4103 5F MOV E,A 4104 E6 F0 ANI F0H Mark the lower nibble 4106 07 RLC Rotate the upper nibble to lower nibble and

save in B reg 4107 07 RLC 4108 07 RLC 4109 07 RLC 410A 47 MOV B,A 410B AF XRA A Clear accumulator 410C 0E 0A REP MVIC 0AH Get the product terms digit multiplied

Page 28: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

28 

410E 80 ADD B 410F 00 DCR C 4110 C2 0E 41 JNZ REP 4113 47 MOV B,A Save the product in B reg 4114 7B MOV B,E Get the BCD data in A reg 4115 E6 0F ANI 0FH Mask the upper nibble 4117 80 ADD B Get the sum of contents digit and the

product in B reg 4118 32 01 42 STA 4250H Save the Binary value in memory 411B 76 HLT Terminate the program

d) Output:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

4200 45 4250 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.

Page 29: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

29 

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. 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 Clear D and E reg to account for hundreds and tens. 2 Load the binary data in A reg. 3 Compare A reg with 64th if carry flag is set goto step 7 else goto next step. 4 Subtract 64th from A reg. 5 Increment E reg(hundreds) goto step 3 6 Compare the A reg with 0AH if carry flag is set goto step 1 else goto next step. 7 Subtract 0AH from A reg. 8 Increment D reg(tens) goto step 7. 9 Combine the terms to form 8 bit result.

10 Save the tens and hundred in memory. 11 Terminate the program.

c) Program:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS 4100 1E 00 MVI E,00H Clear E reg for hundreds

4102 53 MOV D,E Clear D reg for tens 4103 3A 00 42 LDA 4200H Get the binary data in A reg 4106 FE 64 HUND CPI 64H Compare whether data is less than

100(or)64H 4108 DA 11 41 JC TEN If the content of A is less than 100(or)64H

go to ten 410B 06 64 SUI 64H Subtract all the hundreds from the data and

for each subtraction increment E reg

410D 1C INR E 410E C3 06 41 JMP HUND Compare whether the content of A is less

than 0AH or 10

Page 30: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

30 

4111 FE 0A TEN CPI 0AH 4113 DA 1C 41 JC UNIT If CY=1, go to UNIT 4116 D6 0A SUI 0AH Subtract all tens from the data and for each

subtraction increment D reg 4119 C3 11 41 JMP TEN 411C 4F UNIT MOV C,A Save the units in C reg 411D 7A MOV A,D Get tens in A reg 411E 07 RLC Rotate tens digit to upper nibble position 411F 07 RLC 4120 07 RLC 4121 07 RLC 4122 81 ADD C Combine tens and unit digit 4123 32 50 42 STA 4250H Save tens and units in memory 4126 7B MOV A,E 4127 32 51 42 STA 4251H Save hundreds in memory 412A 76 HLT Terminate the program.

d) Output:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

4200 B9 4250 85

4251 01

e) Result:

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

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.

Page 31: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

31 

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. 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 given data in A reg and move to B reg. 2 Mark the upper nibble of binary (Hexa) data in A reg. 3 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 OPCODE LABEL MNEMONICS COMMENTS 4100 3A 00 42 LDA 4200H Get binary data in A 4103 47 MOV B,A Save the binary data in B reg 4104 E6 0F ANI 0FH Mask the upper nibble 4106 CD 1A 41 CALL CODE Call subroutine to get ASCII code 4109 32 01 42 STA 4201H Lower nibble in A and store in memory 410C 78 MOV A,B Get data in A reg 410D E6 F0 ANI F0H Mark the lower nibble 410F 07 RLC rotate upper nibble to lower nibble position 4110 07 RLC

Page 32: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

32 

4111 07 RLC 4112 07 RLC 4113 CD 1A 41 CALL CODE Call subroutine to get ASCII code 4116 32 02 42 STA 4202H Upper nibble in A store in memory 4119 76 HLT

411A FF 0A CODE CPI 0AH If the content of A is less than 0AH then

add 30H to A else add 37H to A reg 411C 0A 21 41 JC SKIP 411F C6 07 ADI 07H 4121 C6 30 SKIP ADI 30H 4123 C9 RET Return to main program.

d) Output:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

4200 E4 4201 34

4202 45

e) Result:

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

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.

Page 33: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

33 

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. 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 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 OPCODE LABEL MNEMONICS COMMENTS 4100 21 00 42 LXI H,4200H Set pointer for ASCII array 4103 56 MOV D,M Set cont for number of data 4104 01 00 43 LXI B,4300H Set pointer for binary array 4107 23 LOOP INX H 4108 7E MOV A,M Get an ASCII data in A reg 4109 C6 13 41 CALL BIN Call subroutine to get binary

410C 02 STAX B Value in A and store in memory

Page 34: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

34 

410D 03 INX B Increment the binary array pointer 410E 15 DCR D 410F C2 07 41 JNZ LOOP Repeat conversion until count is zero 4112 76 HLT Terminate the program.

4113 06 30 BIN SUI 30H Subtract 30H from the data 4115 FF 0A CPI 0AH 4117 08 RC If Y=1 return to main program 4118 06 07 SUI 07H If data is greater than H then subtract 07H 411A C9 RET Return to main program.

d) Output:

ASCII Array INPUT

Binary (Hexa) Array OUTPUT

ADDRESS DATA ADDRESS DATA

4200 07 4300 01

4201 31 4301 0B

4202 42 4302 05

4203 35 4303 0F

4204 46 4304 0C

4205 43 4305 09

4206 39 4306 08

4207 38 - -

e) Result:

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.

Page 35: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

35 

 Experiment Number: 6 (a)

Title of the experiment : 16 – BIT ADDITION USING 8086

Date of the experiment :

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 Quantity 1 8086 Microprocessor Kit 1 2 DC Power Supply 5V 1

b) Procedure for doing the experiment: Sl.No. Details of the step

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

c) Program:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS 1000 A1 MOV AX[1100] Initialize AX reg 1001 00 1002 11 1003 03 ADD AX[1102] Add the content of AX reg 1004 06 1005 02 1006 11 1007 A3 MOV [1200],AX Store the result in 1200 to accumulator 1008 0 1009 12 100A F4 HLT Terminate the program. d) Output:

ASCII Array INPUT Binary (Hexa) Array OUTPUT ADDRESS DATA ADDRESS DATA

1100 1234 1200 68AC 1102 5678 e) Result:

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

Page 36: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

36 

Experiment Number: 6 (b)

Title of the experiment : 16 – BIT SUBTRACTION USING 8086

Date of the experiment :

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 Quantity 1 8086 Microprocessor Kit 1 2 DC Power Supply 5V 1

b) Procedure for doing the experiment: 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 LABEL MNEMONICS COMMENTS 1000 A1 MOV AX[1100] Initialize AX reg 1001 00 Move the data to the A reg 1002 11 1003 2B SUB AX[1102] Subtract the data 1004 06 1005 02 1006 11 1007 A3 MOV [1200],AX Store the result in 1200 to accumulator 1008 00 1009 12 100A F4 HLT Terminate the program. d) Output:

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.

Page 37: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

37 

Experiment Number: 6 (c)

Title of the experiment : 16 – BIT MULTIPLICATION USING 8086

Date of the experiment :

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. Facilities Required Quantity 1 8086 Microprocessor Kit 1 2 DC Power Supply 5V 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 OPCODE LABEL MNEMONICS COMMENTS 1000 A1 MOV AX[1100] Move the data to accumulator. 1001 00 1002 11 MUL [1102] Use multiply instruction multiply the data 1003 F7 1004 26 1005 02 MOV [1200],DX Move the content of DX to location. 1006 11 1007 87 1008 16 1009 00 100A 12 MOV[1202],AX 100B A3 100C 02 100D 12 100E F4 HLT Terminate the program.

Page 38: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

38 

d) Output:

ASCII Array INPUT

Binary (Hexa) Array OUTPUT

ADDRESS DATA ADDRESS DATA

1100 24 1200 48

1101 5A 1201 4B

1102 C2 1202 A4

1103 47 1203 19

e) Result:

Thus the program for 16-bit multiplication using 8086 was executed and verified successfully.

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.

Page 39: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

39 

Experiment Number: 7 (a)

Title of the experiment : 8 – BIT ADDITION USING 8051

Date of the experiment :

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. Facilities Required Quantity 1 8051 Microprocessor Kit 1 2 DC Power Supply 5V 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 OPCODE LABEL MNEMONICS COMMENTS 4100 74 05 MOV A,#Data1 Move data1 to A reg. 4102 24 04 ADD A,#Data2 Add data2 and A reg content 4104 90 45 00 MOV DPTR,#4500 Move the data in address to data pointer 4107 F0 MOVX @ DPTR,A Move A reg to data pointer 4108 80 FE HERE SJMP HERE Jump on HERE

d) Output:

ASCII Array INPUT

Binary (Hexa) Array OUTPUT

ADDRESS DATA ADDRESS DATA

4101 05 4500 09

4104 04

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

Page 40: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

40 

Experiment Number: 7 (b)

Title of the experiment : 8 – BIT SUBTRACTION USING 8051

Date of the experiment :

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. Facilities Required Quantity 1 8051 Microprocessor Kit 1 2 DC Power Supply 5V 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 OPCODE LABEL MNEMONICS COMMENTS 4100 74 05 MOV A,#Data1 Move data1 to A reg. 4102 94 03 SUBB A,#Data2 Subtract data2 and A reg content 4104 90 45 00 MOV DPTR,#4500 Move the data in address to data pointer 4107 F0 MOVX @ DPTR,A Move A reg to data pointer 4108 80 FE HERE SJMP HERE Jump on HERE

d) Output:

ASCII Array INPUT

Binary (Hexa) Array OUTPUT

ADDRESS DATA ADDRESS DATA

4101 05 4500 02

4104 03

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

Page 41: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

41 

Experiment Number: 7 (c)

Title of the experiment : 8 – BIT MULTIPLICATION USING 8051

Date of the experiment :

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. Facilities Required Quantity 1 8051 Microprocessor Kit 1 2 DC Power Supply 5V 1

b) Procedure for doing the experiment:

Sl.No. Details of the step

1 Get the data in A reg. Get the value to be multiplied in D reg. 2 Multiply the data. The high and low nibble of result is atored in A & B reg. 3 Terminate the program.

c) Program:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS 4100 74 0A MOV A,#0A Data is moved to A reg 4102 75 F0 88 MOV B,#88 Data is moved to B erg 4105 A4 MUL A,B Multiply data in A,B 4106 90 45 00 MOV DPTR,#4000 Initialize memory pointer 4109 F0 MOVX @DPTR,A Move A reg content to immediate

DPTR 410A A3 INC DPTR Increment DPTR 410B E5 F0 MOV A,B Move B reg contents to A reg 410D F0 MOVX @DPTR,A Move A reg content to memory pointer 410E 80 FE HERE SJMP HERE Loop is terminated

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.

Page 42: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

42 

 Experiment Number: 7 (d)

Title of the experiment : 8 – BIT DIVISION USING 8086

Date of the experiment :

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. Facilities Required Quantity 1 8051 Microprocessor Kit 1 2 DC Power Supply 5V 1

b) Procedure for doing the experiment:

Sl.No. Details of the step

1 Get the data in A reg. 2 Get the value to be divided in B reg. 3 Divide the data. 4 The Quotient is in A reg and remainder is in B reg. 5 Terminate the program.

c) Program:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS 4100 74 08 MOV A,#08 Data is moved to A reg 4102 75 MOV B,#04 Data is moved to B erg 4105 84 DIV A,B Divide data in A&B 4106 90 45 00 MOV DPTR,#4000 Initialize memory pointer 4109 F0 MOVX @DPTR,A Move A reg content to immediate

DPTR 410A A3 INC DPTR Increment DPTR 410B E5 F0 MOV A,B Move B reg contents to A reg 410D F0 MOVX @DPTR,A Move A reg content to memory pointer 410E 80 FE HERE SJMP HERE Loop is terminated

Page 43: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

43 

d) Output:

ASCII Array INPUT

Binary (Hexa) Array OUTPUT

ADDRESS DATA ADDRESS DATA

4101 08 4500 02

4104 04 4501 00

e) Result:

Thus the program for 8-bit division using 8051 was executed and verified successfully.

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 2’s 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.

Page 44: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

44 

 Experiment Number: 8

Title of the experiment : KEYBOARD AND DISPLAY INTERFACING USING 8279

Date of the experiment :

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. Facilities Required Quantity 1 8085 Microprocessor Kit 1 2 8279 Interface 1 3 DC Power Supply 5V 1

b) Procedure for doing the experiment: Sl.No. Details of the step

1 Start the program execution. 2 Initialize the pointer for array. 3 Initialize the counter for P register. 4 Set mode and clear display and increment display counter. 5 The input data given is displayed. 6 The data is moved to the memory. 7 Terminate the program.

c) Program:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS 4100 21 2C 41 START LXI H,Pointer Set pointer 412CH 4103 16 0F MVI D,0FH Initialize counter 4105 3E 10 MVI A,10H 4107 D3 C2 OUT CNT Set mode and display 4109 3E CC MVI A,CCH Clear display 410B D3 C2 OUT CNT 410D 3E 90 MVI A,90H Write display 410E D3 C2 OUT CNT 4111 7E LOOP MOV A,M 4112 D3 C0 OUT DAT 4114 CD 1F 41 CALL DELAY 4117 23 INX H Increment the pointer 4118 15 DCR D Decrement the counter 4119 C2 11 41 JNZ LOOP Jump if non zero

Page 45: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

45 

411C C3 00 41 JMP START Display the next character 411F 06 A0 DELAY MVI B,0A0H 4121 0E FF LOOP1 MVI C,0FFH 4123 0D LOOP2 DCR C 4124 C2 23 41 JNZ LOOP2 4127 05 DCR B 4128 C2 21 41 JNZ LOOP1 412B C9 RET 412C FF FF FF FF 4130 FF FF FF FF 4134 98 68 11 18 4138 1C 29 FF FF

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.

Page 46: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

46 

Experiment Number: 9(a)

Title of the experiment : 8255 INTERFACING USING MODE ‘0’

Date of the experiment :

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 Quantity 1 8085 Microprocessor Kit 1 2 8255 Interface 1 3 DC Power Supply 5V 1

b) Procedure for doing the experiment: 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 LABEL MNEMONICS COMMENTS 4100 3E 90 MVI A,90 Initialize port A as I/P and Port B as

output port. 4102 D3 C6 OUT C6 4104 DB C0 IN CO Read port A 4106 D3 C2 OUT C2 Output the data at port B 4108 76 HLT Terminate the program.

d) Output:

INPUT OUTPUT

Port A Port B

11101001 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.

Page 47: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

47 

Experiment Number: 9(b)

Title of the experiment : 8255 INTERFACING USING MODE ‘1’

Date of the experiment :

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 Quantity 1 8085 Microprocessor Kit 1 2 8255 Interface 1 3 DC Power Supply 5V 1

b) Procedure for doing the experiment: 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 processor. 3 Terminate the program.

c) Program:

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

d) Output:

INPUT OUTPUT Port A DISPLAY

01010101 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.

Page 48: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

48 

 Experiment Number: 9(c)

Title of the experiment : 8255 INTERFACING USING MODE ‘2’

Date of the experiment :

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 Quantity 1 8085 Microprocessor Kit 1 2 8255 Interface 1 3 DC Power Supply 5V 1

b) Procedure for doing the experiment: Sl.No. Details of the step

1 Start the program execution. 2 Initialize the input through processor. 3 Input the data and processor. 4 Output the data at port C. 5 Terminate the program.

c) Program:

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

d) Output:

4105 A B Port C 1010 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

Page 49: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

49 

 Experiment Number: 10

Title of the experiment : ADC INTERFACING

Date of the experiment :

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. 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 Move immediately the value of accumulator output. 2 Move immediately as another value of accumulator. 3 EX-OR the value for 3 times. 4 Initialize A reg as 00. 5 Get the output at 00. 6 Terminate the program.

c) Program:

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

Page 50: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

50 

d) Output:

Analog Voltage Digital Voltage Digital Data 0V 0000 0000 00

1.3V 0010 1001 29 1.66V 0001 1110 1A 2.17V 0111 1010 7F 2.68V 0010 1001 29 3.45V 0111 1101 7B 4.09V 1100 0111 C7 4.66V 1111 1111 FF

e) Result:

Thus the ADC interfacing program was executed and verified successfully.

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 AJMP(Absolute Jump)-address 11 SJMP(Short Jump)-relative address

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.

Page 51: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

51 

Experiment Number: 11(a)

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

Date of the experiment :

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 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 Call the delay program. 3 Load the final value (FF) to accumulator and move it to DAC. 4 Call the delay program. 5 Repeat the steps 2 and 4 6 Terminate the program.

c) Program:

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

Page 52: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

52 

d) Output:

Amplitude Time

10V 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.

Time 

Amp 

Page 53: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

53 

Experiment Number: 11(b)

Title of the experiment : DAC INTERFACING – SAWTOOTH WAVE GENERATION

Date of the experiment :

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 OPCODE LABEL MNEMONICS COMMENTS 4100 3E 00 START MVI A,00 Move 00 to A reg. 4102 D3 C0 L1 OUT 0C0H 4104 3C INR A 4105 C2 02 41 JNZ L1 Jump to L1 4108 C3 00 41 JMP START Jump to START

d) Output:

Amplitude Time

10V 60ms e) Result:

Thus the program for sawtooth wave generation was executed and verified successfully.

Time 

Amp 

Page 54: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

54 

Experiment Number: 11(c)

Title of the experiment : DAC INTERFACING – TRIANGULAR WAVE GENERATION

Date of the experiment :

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. 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. 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 OPCODE LABEL MNEMONICS COMMENTS 4100 2E 00 START MVI L,00 Move 00 to L reg. 4102 7D L1 MOV A,L Move L reg to A reg 4103 D3 C8 OUT C8H 4105 2C INR L 4106 C2 02 41 JNZ L1 If ZF=0, gato LOOP1 4109 2F FF MVI L,0FFH Move 0FFH to L reg 410B 7D L2 MOV A,L Move L reg to A reg 410C D3 C8 OUT C8H 410E 2D DCR L Decrement the L reg pair 410F C2 0B 41 JNZ L2 If ZF=0, gato step 2 4112 C3 00 41 JMP START Jump to START

d) Output: Amp 

Page 55: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

55 

Amplitude Time

10V 60ms

Analog Voltage in Volts(V)

Digital Output Decimal

MSB LSB 0 0000 0000 0

0.02 0010 0010 3A 1.08 0011 1011 59 1.67 0011 1011 59 2.51 0011 0001 113 2.56 0111 1001 113 3.21 0111 0001 118 3.60 1100 1011 203 4.15 1100 0011 227 4.67 1111 1111 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.

Time 

Page 56: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

56 

Experiment Number: 12(a)

Title of the experiment : STEPPER MOTOR INTERFACING WITH 8051

Date of the experiment :

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. Facilities Required Quantity 1 8051 Microprocessor Kit 1 2 8279 interfacing Kit 1 3 DC Power Supply 5V 1

b) Procedure for doing the experiment:

Sl.No. Details of the step

1 Start the program. 2 The port and 8279 are initiated. Set the count for 4-stepping sequence. 3 Call subroutine wait for 1ms. Decrement the counter. 4 Count zero is checked then set the count for 4-stepping sequence else goto

initializing ports. 5 Terminate the program.

c) Program:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS 4100 7C 33 START MOV V4,#33H Initialize count 4102 90 41 44 L2 MOV DPTR Initialize pointer 4105 # FORWARD Excitation 4106 12 41 1C LCALL L1 Long jump to loop1 4108 DC 78 DJNZ R4,L2 Decrement R4 410A 12 41 3B LCALL DELAY 410D 7C 33 MOV DPTR Initialize count 410F 90 41 48 L3 #REVERSE

LCALL L1 Long call loop1 4112 12 41 1C MOV R4,#33H Move 33H to R4 4115 DC 78 DJNZ R4,L3 Decrement R4 4117 12 41 3B LCALL DELAY Wait for subroutine 411A 80 E4 SJMP START Short jump to start 411C 78 04 L1 MOV R0,#04 Move 04 to reg R0 411E E0 LOOP PUSH DPH 411F CD 83 PUSH DCH 4121 C0 82 MOV DPTR,#FF Move FF data to DPTR

Page 57: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

57 

4123 90 FF C0 MOV DPTR,#FF 4126 7A 04 MOV R2,#04 Move 04 to reg R2 4128 79 05 L7 MOV R1,#05 412A 7B FF L6 MOV R3,#FF Move FF to reg R3 412C DB FE L4 DJNZ R3,L4 Decrement R3 goto L4 412E D9 FA DJNZ R1,L6 Decrement R1 goto L6 4130 DA 16 DJNZ R2,L7 Decrement R2 goto L7 4132 F0 MOVX@DPTR,A Move A to DPTR 4133 00 82 POP DLH Decrement DLH 4135 D0 83 POP DPH 4137 D8 E4 INC DPTR Increment pointer 4138 22 DJNZ R0,LOOP 413A 22 RET 413B 7D 01 MOV R5,#01 Move 01 to reg R5 413D 7A 05 DELAY MOV R2,#05 Move 05 to reg R2 413F DA FF L9 DJNZ R2,L8 Decrement R2 4141 DD FA L8 DJNZ R5,L9 Decrement R5 4143 22 RET 4144 D9 05 06 0A Forward D9 05 06 0A 4145 0A 06 05 09 Reverse 0A 06 05 09

d) Output:

Clockwise direction Anti-Clockwise Direction

Address Data 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

Page 58: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

58 

Experiment Number: 12(b)

Title of the experiment : INTERFACING 8051 WITH DC MOTOR

Date of the experiment :

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. Facilities Required Quantity 1 8051 Microprocessor Kit 1 2 DC Power Supply 5V 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 74 FF MOV A, #FF Move FF into accumulator 4502 90 FF C0 MOV DPTR,#FF10H Load the value FF 10H into the data pointer 4505 F0 MOVX @DPTR,A Move the data content to the accumulator 4506 80 FF SIMPL Instruction is executed.

d) Output:

A Reg Speed Accumalator FF High 5V 7F Medium 3V 55 Low 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.

Page 59: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

59 

Experiment Number: 13

Title of the experiment : Program to find square and cube of a number

Date of the experiment :

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. Facilities Required Quantity 1 8086 Microprocessor Kit 1 2 DC Power Supply 5V 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:

Input Output Square 4h 10h Cube 4h 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.

Page 60: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

60 

Experiment Number: 14

Title of the experiment : Program to find LCM of a given number

Date of the experiment :

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. Facilities Required Quantity 1 8086 Microprocessor Kit 1 2 DC Power Supply 5V 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.

Page 61: CS2259-MICROPROCESSOR AND MICROCONTROLLER … LAB MANUAL.pdf · CS2259-MICROPROCESSOR AND MICROCONTROLLER ... Dr NNCE IT / IV‐SEM MP&MC LAB‐LM 3 HARDWARE ... 5. 8051 Microcontroller

Dr NNCE  IT / IV‐SEM  MP&MC LAB‐LM 

61 

d) Output: Input Output

0A, 04 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.