48
MICROPROCESSOR LAB CODE: PEC –503 LIST OF EXPERIMENT 1-To perform addition & subtraction of 8 bit number. 2-To perform addition & subtraction of 8 bit number with carry / borrow. 3- Write a program to split a byte into nibble of 8 bit data using 8085 Microprocessor. 4- (A) Write an ALP to find one’s complement of 8 bit data. (b) Write an ALP to find two’s complement of 8 bit data. 5- (A) Write an ALP to find one’s complement of 16 bit data. (b) Write an ALP to find two’s complement of 16 bit data. 6- Write an ALP to add two 16 bit data with carry. 7- (A) Write an ALP to find larger number between two numbers. (b) Write an ALP to find smaller number between two numbers.

Final Manual of Microprocessor

Embed Size (px)

Citation preview

Page 1: Final Manual of Microprocessor

MICROPROCESSOR LABCODE: PEC –503

LIST OF EXPERIMENT

1-To perform addition & subtraction of 8 bit number.

2-To perform addition & subtraction of 8 bit number with carry / borrow.

3- Write a program to split a byte into nibble of 8 bit data using 8085 Microprocessor.

4- (A) Write an ALP to find one’s complement of 8 bit data. (b) Write an ALP to find two’s complement of 8 bit data.

5- (A) Write an ALP to find one’s complement of 16 bit data. (b) Write an ALP to find two’s complement of 16 bit data.

6- Write an ALP to add two 16 bit data with carry.

7- (A) Write an ALP to find larger number between two numbers.(b) Write an ALP to find smaller number between two numbers.

8- Write an ALP to find largest /smallest in a series of n number.

9- Write an ALP to find multiplication of 8 bit number.

11-Write an ALP for interfacing of PPI 8255 with microprocessor 8085.

12-Write an ALP for Traffic light controller using 8085

Page 2: Final Manual of Microprocessor

GRAPHIC ERA UNIVERSITY566/6, BELL ROAD CLEMENT TOWN,

DEHRADUN (UTTARAKHAND)

B.TECH- IV SEMESTERMicroprocessor Lab

Subject Code: PEC-503

Prepared By: Checked By:Mr.Ashish Bhardwaj Ms.S.Mohanty

Approved By:Dr. AnamikaBhatia, Professor& H.O.D

Department of Electronics & Communication Engg

Page 3: Final Manual of Microprocessor

Experiment No: 1

Title: Write an assembly language program for addition & subtraction of 8 bit data using 8085 microprocessor.

Objectives:1: Addition of 8 bit data using 8085 microprocessor.2: Subtraction of 8 bit data using 8085 microprocessor.

Apparatus Required: 8085 Microprocessor trainer kit

Precautions: 1.Handle the kit carefully. 2. Write the instruction properly.

3.Load the address location between 2000H to 4000H.

Problem Solution: 1. Load two numbers (8-bit data) in two different memory locations.2. Move one of the numbers in Accumulator3. Find addition/subtraction of these numbers4. Store the addition/subtraction to a memory location.

Program:1 [a] 8 bit addition:

Address Label Mnemonics Operands Comments

2000 LXI H,MEM1Get address of 1st no. in H-L pair. from MEM1

2003 MOV A, MCopy the contents from memory to accumulator.

2004 INX HIncrement contents of H-L pair.

2005 ADD MAdd the contents of memory to the accumulator.

2006 STA MEM2Store the contents of accumulator to MEM2.

2009 HLT Stop the Program.

Page 4: Final Manual of Microprocessor

1 [a.1] 8 bit addition: Address Label Mnemonics Operands Comments

2000 LDA MEM1Get the 1st no. from MEM1.

2003 MOV B, ACopy the contents from A to B register.

2004 LDA MEM2Get the 2nd no. from MEM2

2005 ADD BAdd the contents of register B to the accumulator.

2006 STA MEM3Store the contents of accumulator to MEM3.

2009 HLT Stop the Program.

1 [b] 8 bit subtraction:Address Label Mnemonics Operands Comments

2000 LXI H, MEM3Get address of 1st no. in H-L pair from MEM1.

2003 MOV A, MCopy the contents from memory to accumulator.

2004 INX HIncrement contents of H-L pair.

2005 SUB MSubtract the contents of memory to the accumulator.

2006 STA MEM4Store the contents of accumulator to MEM4.

2009 HLTStop the Program

Page 5: Final Manual of Microprocessor

1 [b.1] 8 bit subtraction:Address Label Mnemonics Operands Comments

2000 LDA MEM1Get the 1st no. from MEM1.

2003 MOV B, ACopy the contents from A to B register.

2004 LDA MEM2Get the 2nd no. from MEM2

2005 SUB B

Subtract the contents of register B to the accumulator.

2006 STA MEM3Store the contents of accumulator to MEM3.

2009 HLT Stop the Program.

Result:

For addition

INPUT MEMORY LOCATION DATA

OUTPUT MEMORY LOCATION DATA

For subtraction

INPUT MEMORY LOCATION DATA

OUTPUT MEMORY LOCATION DATA

Page 6: Final Manual of Microprocessor

Conclusion:

Experiment No: 2

Title: Write an assembly language program for addition & subtraction( with carry/borrow)of 8 bit data using 8085 microprocessor.

Page 7: Final Manual of Microprocessor

Objectives:1: addition of 8 bit data with carry using 8085 microprocessor.2: subtraction of 8 bit data with borrow using 8085 microprocessor.

Apparatus Required: 8085 Microprocessor trainer kit

Precautions: 1.Handle the kit carefully 2. Write the instruction properly 3 .Load the address location between 2000H to 4000H.

Problem Solution: 1. Initialize a register with content 00 for carry.2. Load two numbers (8-bit data) in two different memory locations. 3. Move one of the numbers in Accumulator4. Find addition/subtraction of these numbers5. Check the condition for carry/borrow.6. If carry/borrow generated increment the register (that was initialize with the content 00 earlier) by 1.7. Store the addition/subtraction to a memory location.8. Store the carry to a memory location.

Program:

2 [a] 8 bit addition with carry

Address Label Mnemonics Operands Comments

2000 LXI H, MEM1Get address of 1st no. in H-L pair.

2003 MVI C, 00H Initial value of C=0

2005 MOV A, MCopy the contents from memory to accumulator.

2006 INX H Increment content of H-L pair.

2007 ADD MAdd the contents of memory to the accumulator.

2008 JNC NEXTIs carry? If No, go to the label NEXT.

200B INR CIf Yes, increment the value of C.

200C NEXT STA MEM3Store the contents of accumulator to MEM3

200F MOV A, C Copy the contents

Page 8: Final Manual of Microprocessor

from register C to register A.

2010 STA MEM4Store the contents of accumulator to MEM4

2013 HLT Stop the Program.

2 [a.1] 8 bit addition with carry

Address Label Mnemonics Operands Comments

2000 LDA MEM1Get the 1st no. in accumulator.

2003 MVI C, 00H Initial value of C=0

2005 MOV B, ACopy the contents from Accumulator to register B.

2006 LDA MEM2Get the 2nd no. in accumulator

2007 ADD BAdd the contents of register to the accumulator.

2008 JNC NEXTIs carry? If No, go to the label NEXT.

200B INR CIf Yes, increment the value of C.

200C NEXT STA MEM3Store the contents of accumulator to MEM3

200F MOV A, CCopy the contents from register C to register A.

2010 STA MEM4Store the contents of accumulator to MEM4

2013 HLT Stop the Program.

2 [b] 8 bit subtraction with borrowAddress Label Mnemonics Operands Comments

2000 LXI H, MEM1 Get address of 1st no. in H-L pair.

Page 9: Final Manual of Microprocessor

2003 MVI B, 00HInitial value of B=0

2005 MOV A, MCopy the contents from memory to accumulator.

2006 INX H Increment content of H-L pair.

2007 SUB M

Add the contents of memory to the accumulator.

2008 JNC NEXTIs borrow? If No, go to the label NEXT.

200B INR BIf Yes, increment the value of B.

200C NEXT STA MEM3Store the contents of accumulator to MEM3.

200F MOV A, BCopy the contents from register B to register A.

2010 STA MEM4

Store the contents of accumulator to MEM4.

2013 HLT Stop the Program.

2 [b.1] 8 bit subtraction with borrow

Address Label Mnemonics Operands Comments

2000 LDA MEM1Get the 1st no. in accumulator.

Page 10: Final Manual of Microprocessor

2003 MVI B, 00HInitial value of B=0

2005 MOV C, ACopy the contents from Accumulator to register C.

2006 LDA MEM2Get the 2nd no. in accumulator

2007 SUB C

Subtract the content of Register C from the content of accumulator.

2008 JNC NEXTIs borrow? If No, go to the label NEXT.

200B INR BIf Yes, increment the value of B.

200C NEXT STA MEM3Store the contents of accumulator to MEM3.

200F MOV A, BCopy the contents from register B to register A.

2010 STA MEM4

Store the contents of accumulator to MEM4.

2013 HLT Stop the Program.

Result:

For addition with carry

INPUT MEMORY LOCATION DATA

Page 11: Final Manual of Microprocessor

OUTPUT MEMORY LOCATION DATA

For subtraction with borrow

INPUT MEMORY LOCATION DATA

OUTPUT MEMORY LOCATION DATA

Conclusion:

Experiment No: 3

Title: Write an assembly language program to split a byte into nibble of 8 bit data using 8085 microprocessor.

Objective: Split a byte into nibble.

Apparatus Required: 8085 Microprocessor trainer kit

Page 12: Final Manual of Microprocessor

Precautions: 1.Handle the kit carefully 2. Write the instruction properly 3 .Load the address location between 2000H to 4000H.

Problem Solution: 1. Load a numbers (8-bit data) in a memory locations.2. Move the number in Accumulator.3. AND the content of accumulator with content 0F.4. Store the content of accumulator in a memory location5. Again load the numbers (8-bit data) in a memory locations6. Move the number in Accumulator.7. AND the content of accumulator with content F0.8.Rotate the content of accumulator left (4-Tmies)9. Store the content of accumulator in a memory location

Program:

3[a]Split a byte into nibbleAddress Label Mnemonics Operands Comments

2000 LDA MEM1

Get data in accumulator from MEM1.

2003 MOV B, A

Copy the contents from accumulator to B register.

2005 ANI , 0F HMasking of MSB

2007 STA MEM2Store the value of accumulator to MEM2.

200A MOV A,B

Copy the contents from B register to accumulator.

200B ANI , F0 HMasking of LSB

200D RLCShift MSB with 1 bit

200E RLCShift MSB with 2 bit

200F RLCShift MSB with 3 bit

2010 RLCShift MSB with 4 bit

Page 13: Final Manual of Microprocessor

201 STA MEM3Store the value of accumulator to MEM3.

2017 HLTStop the Program.

Program:3[a.1]

Address Label Mnemonics Operands Comments

2000 LXI H, MEM1Get address of 1st no. in H-L pair.

2003 MOV A, MCopy the contents from mem1 to accumulator

2004 ANI , 0F HMasking of MSB

2006 STA MEM2Store the value of accumulator to MEM2.

2009 MOV A, MCopy the contents from mem1 to accumulator

200A ANI , F0 HMasking of LSB

200C RLCShift MSB with 1 bit

200D RLCShift MSB with 2 bit

200E RLCShift MSB with 3 bit

200F RLCShift MSB with 4 bit

2010 STA MEM3Store the value of accumulator to MEM3.

2013 HLT Stop the Program.

Result:

INPUT MEMORY LOCATION DATA

OUTPUT MEMORY LOCATION DATA

Page 14: Final Manual of Microprocessor

Conclusion:

Experiment No: 4

Title: Write an assembly language program to find 1’s&2’sComplement of 8 Bit data using 8085 microprocessor.

Objectives:1: Find 1’s complement of 8 bit data using 8085 microprocessor.2: Find 2’s complement of 8 bit data using 8085 microprocessor.

Page 15: Final Manual of Microprocessor

Apparatus Required: 8085 Microprocessor trainer kit

Precautions: 1.Handle the kit carefully 2. Write the instruction properly 3.Load the address location between 2000H to 4000H.

Problem Solution: For 1,s complement:1. Load the number (8-bit data) in a memory locations.2. Move the number in Accumulator3. Find complement (1’s complete) of 8 bit data.4. Store the content of accumulator(complemented data) in another memory location.

For 2,s complement:1. Load the number (8-bit data) in a memory locations.2. Move the number in Accumulator3. Find complement (1’s complete) of 8 bit data.4. Add 01 to the content of accumulator.4. Store the content of accumulator (2’s complemented data) in another memory location.

Program:

4[a] 1’s complement of 8-bit dataAddress Label Mnemonics Operands Comments

2000 LXI MEM1Get address of 1st no. in H-L pair.

2003 MOV A, M

Copy the contents from memory to accumulator.

2004 CMACompliment the contents of the accumulator.

2005 STA MEM2Store the value of accumulator to MEM2

2008 HLTStop the Program.

4[a.1] 1’s complement of 8-bit dataAddress Label Mnemonics Operands Comments

Page 16: Final Manual of Microprocessor

2000 LDA MEM1Get data in accumulator from MEM1

2003 CMACompliment the contents of the accumulator.

2004 STA MEM2Store the value of accumulator to MEM2

2007 HLTStop the Program.

4[b] 2’s complement of 8-bit dataAddress Label Mnemonics Operands Comments

2000 LDA MEM1Get data in accumulator from MEM1

2003 CMACompliment the contents of the accumulator.

2004 ADI 01Add one to the contents of the accumulator.

2006 STA MEM2 Store the value of accumulator to MEM2.

2009 HLTStop the Program.

4[b.1] 2’s complement of 8-bit dataAddress Label Mnemonics Operands Comments

2000 LXI H, MEM1Get address of 1st no. in H-L pair.

2003 MOV A, M

Copy the contents from memory to accumulator.

2004 CMACompliment the contents of the accumulator.

2005 ADI 01Add one to the contents of the accumulator.

Page 17: Final Manual of Microprocessor

2007 STA MEM2 Store the value of accumulator to MEM2.

200A HLTStop the Program.

Result:

For 1’s COMPLEMENT

INPUT MEMORY LOCATION DATA

OUTPUT MEMORY LOCATION DATA

For 2’s COMPLEMENT

INPUT MEMORY LOCATION DATA

OUTPUT MEMORY LOCATION DATA

Conclusion:

Experiment No: 5

Title: Write an assembly language program to find 1’s&2’s Complement of 16 Bit data using 8085 microprocessor.

Objectives:1: Find 1’s complement of 16 bit data using 8085 microprocessor.2: Find 2’s complement of 16 bit data using 8085 microprocessor.

Page 18: Final Manual of Microprocessor

Apparatus Required: 8085 Microprocessor trainer kit

Precautions: 1.Handle the kit carefully 2. Write the instruction properly

Problem Solution: For 1,s complement:1. Load the number (16-bit data) in two memory locations.2. Move the number of one memory location into Accumulator3. Find complement (1’s complete) of 8 bit data.4. Store the content of accumulator (complemented data) in another memory location.2. Move the number of another memory location into Accumulator3. Find complement (1’s complete) of 8 bit data.4. Store the content of accumulator (complemented data) in another memory location.

For 2,s complement:1. Load the number (16-bit data) in two memory locations.2. Move the number(lower byte) of one memory location into Accumulator.3. Find complement (1’s complete) of 8 bit data.4. Add 01 to the content of accumulator.4. Store the content of accumulator (2’s complemented data) in another memory location.2 Move the number(Upper byte) from memory location into Accumulator.3. Find complement (1’s complete) of 8 bit data.4. If carry is generated from the 1st addition add that carry to accumulator.4. Store the content of accumulator in another memory location.

PROGRAM:

5[a] 1’s complement of 16-bit dataAddress Label Mnemonics Operands Comments

2000 LHLD H, MEM1Get data in H-L pair.

2003 MOV A, HCopy higher byte from H to accumulator.

2004 CMACompliment the contents of the accumulator.

2005 MOV H,AStore the value of accumulator in H

2006 MOV A,LCopy lower byte from L to accumulator.

Page 19: Final Manual of Microprocessor

2007 CMACompliment the contents of the accumulator.

2008 MOV L,ACopy the contents of accumulator to L

2009 SHLD MEM3Store the value of H &L to MEM3&MEM4

200C HLTStop the Program.

5[a.1] 1’s complement of 16-bit dataAddress Label Mnemonics Operands Comments

2000 LXI H, MEM1Get the address of lower byte in H-L pair.

2003 MOV A, MCopy lower byte from MEM1 to accumulator.

2004 CMACompliment the contents of the accumulator.

2005 STA MEM3Store the value of accumulator in MEM3

2008 INX HIncrement the HL pair by 1.

2009 MOV A, MCopy higher byte from MEM2 to accumulator.

200A CMACompliment the contents of the accumulator.

200B STA MEM4Store the value of accumulator in MEM4

200E HLTStop the Program.

5[b] 2’s complement of 16-bit dataAddress Label Mnemonics Operands Comments

2000 MVI C ,00HInitialize the register C=00

Page 20: Final Manual of Microprocessor

2002 LXI H, MEM1Get the address of lower byte in H-L pair.

2005 MOV A, MCopy lower byte from MEM1 to accumulator.

2006 CMACompliment the contents of the accumulator.

2007 ADI 01HAdd 01 to the content of accumulator

2009 JNC NEXTJump to the Label if carry is not generated

200A INR CIncrement the register C by 1.

200B NEXT STA MEM3Store the content of accumulator to MEM3.

200E INX HIncrement the contents of HL pair

200F MOV A,M

Move the content of MEM2(higher byee) to accumulator

2010 CMA Complement the content of accumulator

2011 ADD C Add the content of register C with the content of accumulator.

2012 STA MEM4 Store the content of accumulator to MEM4.

2015 HLT Stop the Program

5[b.1] 2’s complement of 16-bit dataAddress Label Mnemonics Operands Comments

2000 LHLD H, MEM1Get data in H-L pair.

Page 21: Final Manual of Microprocessor

2003 MOV A, HCopy higher byte from Hto accumulator.

2004 CMACompliment the contents of the accumulator.

2005 MOV H,AStore the value of accumulator in H

2006 MOV A,LCopy lower byte from L to accumulator.

2007 CMACompliment the contents of the accumulator.

2008 MOV L,ACopy the contents of accumulator to L

2009 INX HIncrement the contents of HL pair

200A SHLD MEM3Store the value of H & L to MEM3 &MEM4.

200D HLT Stop the Program

Result:

For 1’s COMPLEMENT

INPUT MEMORY LOCATION DATA

OUTPUT MEMORY LOCATION DATA

Page 22: Final Manual of Microprocessor

For 2’s COMPLEMENT

INPUT MEMORY LOCATION DATA

OUTPUT MEMORY LOCATION DATA

Conclusion:

Experiment No: 6

Title: Write an assembly language program to add two 16 bit numbers from given memory locations with carry. Objectives: To add two 16-bit numbers

Page 23: Final Manual of Microprocessor

Apparatus Required: 8085 Microprocessor trainer kit

Program:

6[a] 16 bit addition with carry:Address Label Mnemonics Operands Comments

2000 LHLD MEM1

Load the H-L pair with the values from MEM1 and MEM2.

2003 XCHG

Exchange the values of H-L and D-E pair of registers.

2004 LHLD MEM3

Load the H-L pair with the values from MEM3and MEM4.

2007 MVI C, 00H Initial value ofC = 0

2009 DAD DShift partial product left by 1 bit.

200A SHLD MEM5Store the value of H-L pair to MEM5 & MEM6.

200D JNC NEXTIs carry? If NOT, then jump to label NEXT

2010 INR CIncrement the value of C by 1

2011 NEXT MOV A, CCopy the contents of reg. C to reg. A.

2012 STA MEM7Store the value of accumulator to MEM7.

2015 HLTStop the Program.

Page 24: Final Manual of Microprocessor

Result:

For addition 16 bit

INPUT MEMORY LOCATION DATA

OUTPUT MEMORY LOCATION DATA

Conclusion:

Experiment No: 7

Title: Write an assembly language program to find the larger /smaller between two numbers.

Page 25: Final Manual of Microprocessor

.Objectives:1: Larger between two 8 bit data using 8085 microprocessor.2: Smaller between two 8 bit data using 8085 microprocessor.

Apparatus Required: 8085 Microprocessor trainer kit

Precautions: 1.Handle the kit carefully. 2. Write the instruction properly.

3. Load the address location between 2000H to 4000H.

Problem Solution: 1. Load two numbers (8-bit data) in two different memory locations.2. Move one of the numbers in Accumulator3. Compare the two numbers.4. Check for the carry condition and display the largest /smallest number in the respective location.

Program:

7(a) Program to find the larger in between two numbers.

Address Label Mnemonics Operands Comments

2000 LXI H , MEM1Get address for count in H-L pair from the MEM1.

2003 MOV A,M

Copy the contents from memory to accumulator

2004 INX H Increment content of H-L pair.

2005 CMP M

Compare the contents of memory with the accumulator.

2006 JNC FRONTIs carry? NO, then go to the label FRONT.

2007 MOV A, M

Yes, Copy the contents from memory to accumulator.

Page 26: Final Manual of Microprocessor

2008 FRONT STA MEM2

Store the contents of accumulator to memory location MEM2

200B HLTStop the Program.

7(b) Program to find the smaller in between two numbers

Address Label Mnemonics Operands Comments

2000 LXI H , MEM1Get address for count in H-L pair.

2003 MOV A,M

Copy the contents from memory to accumulator

2004 INX H Increment content of H-L pair.

2005 CMP M

Compare the contents of memory with the accumulator.

2006 JC FRONTIs carry? yes, then go to the label FRONT.

2007 MOV A, M

Yes, Copy the contents from memory to accumulator.

2008 FRONT STA MEM2

Store the contents of accumulator to memory location MEM2.

200B HLTStop the Program.

Page 27: Final Manual of Microprocessor

Result:

For larger number

INPUT MEMORY LOCATION DATA

OUTPUT MEMORY LOCATION DATA

For smaller number

INPUT MEMORY LOCATION DATA

OUTPUT MEMORY LOCATION DATA

Conclusion:

Experiment No: 8

Page 28: Final Manual of Microprocessor

Title: Write an assembly language program to find the largest/ smallest in a series of Numbers.

Objectives:1: Largest among a series of 8 bit data using 8085 microprocessor.2: Smallest among a series of 8 bit data using 8085 microprocessor .

Apparatus Required: 8085 Microprocessor trainer kit

Precautions: 1.Handle the kit carefully. 2. Write the instruction properly.

3. Load the address location between 2000H to 4000H.

Problem Solution: 1. Load the series of numbers (8-bit data) in consecutive memory locations and also the counter representating the count of the series .2. Move one of the numbers in Accumulator and the other with that of memory location.3. Compare the two numbers .4. Check for the carry condition .5. According to the condition satisfied check for the entire series of numbers specified by the counter.6. After the entire count display the result.

Program:

8(a) Program to find the largest in a series of n number.Address Label Mnemonics Operands Comments

2000 LXI H , MEM1Get address for count in H-L pair from the MEM1.

2003 MOV C, MCopy the contents from memory to C register.

2004 DCR CDecrement the value of count.

2005 INX HIncrement content of H-L pair

2006 MOV A,MCopy the contents from memory to accumulator.

2007 BACK INX HIncrement content of H-L pair

2008 CMP M Compare the contents

Page 29: Final Manual of Microprocessor

of memory with the accumulator.

2009 JNC FRONTIs carry? NO, then go to the label FORNT.

200C MOV A,MYes, Copy the contents from memory to accumulator.

200D FRONT DCR CDecrement the value of count.

200E JNZ BACKIs Zero? If NOT, then jump to label BACK.

2011 STA MEM2Store the contents of accumulator to memory location MEM2.

2014 HLT Stop the Program.

8(b) Program to find the smallest in a series of n number.

Address Label Mnemonics Operands Comments

2000 LXI H , MEM1Get address for count in H-L pair from MEM1.

2003 MOV C, MCopy the contents from memory to C register.

2004 INX H Increment content of H-L pair.

2005 MOV A,MCopy the contents from memory to accumulator.

2006 BACK INX HIncrement content of H-L pair.

2007 CMP MCompare the contents of memory with the accumulator.

2008 JC FRONTIs carry? yes, then go to the label FRONT.

200B MOV A, MYes, Copy the contents from memory to accumulator.

200C FRONT DCR CDecrement the value of count.

200D JNZ BACKIs zero? If NOT, then jump to label BACK.

2010 STA MEM2 Store the contents of accumulator to memory

Page 30: Final Manual of Microprocessor

location MEM22013 HLT Stop the Program.

Result:

For largest among a series of n number (n=5)

INPUT MEMORY LOCATION DATA

OUTPUT MEMORY LOCATION DATA

For smallest among a series of n number (n=5)

INPUT MEMORY LOCATION DATA

OUTPUT MEMORY LOCATION DATA

Conclusion:

Experiment No: 9

Page 31: Final Manual of Microprocessor

Title: Write an assembly language program to multiply two 8 bit numbers

Objective: Multiply two 8 bit data using 8085 microprocessor.

Apparatus Required: 8085 Microprocessor trainer kit

Precautions: 1.Handle the kit carefully. 2. Write the instruction properly.

3. Load the address location between 2000H to 4000H.

Problem Solution: 1. Load the multiplicand in H-L register pair .2. Load the multiplier in the Accumulator .3. Repeated addition of the multiplicand is done .4. The multiplication done below follows the principle of binary multiplication .5. This coding generates product of 8 and 16 bit numbers.

Program:

9 Program to multiply two 8 bit numbers.Address Label Mnemonics Operands Comments

2000 LHLD MEM1Get multiplicand in H-L from MEM1.

2003 XCHG Multiplicand in D-E.

2004 LDA MEM2Multiplier in accumulator.

2007 LXI H, 0000H Initial product is 0000H

200A MVI C,08HLoad the count to be 8 bits.

200C LOOP DAD HShift partial product left by 1 bit.

200D RALRotate to get the value as 1 or 0 bit.

200E JNC AHEADIs carry? NO, then go to the label AHEAD.

2011 DAD DRepeated addition of multiplicand .

2012 AHEAD DCR CDecrement the value of count till 8 encounters.

Page 32: Final Manual of Microprocessor

2013 JNZ LOOPIs Zero? If NOT, then jump to label LOOP.

2014 SHLD MEM3Store the contents of H-L to memory location MEM3.

2017 HLT Stop the Program.

Result:

For multiplication of 8 bit numbers

INPUT MEMORY LOCATION DATA

OUTPUT MEMORY LOCATION DATA

Conclusion:

Page 33: Final Manual of Microprocessor

Experiment No: 10

TITLE: Write an assembly language program to interface 8255 PPI with 8085 Microprocessor1: All the ports of 8255 is used as output ports.2: Find the 2’s complement of 8 bit numbers by interfacing it with 8255 in which Port A is used as input port and Port B and Port C is used as output port.

APPARATUS USED: 8085 Microprocessor trainer kit and 8255 PPI Kit.

Precautions: 1.Handle the kit carefully. 2. Write the instruction properly.

3. Load the address location between 30H,31H,32H,33H.

Problem Solution: 1. 8255 PPI has three ports with address locations 30,31,32 and 33H used for Port A, Port B, Port C and CWR respectively.2. For input the instructions used is IN and for output its OUT.3. The result is displayed accordingly on the specified 8255 kit .

PROGRAM:

10(a) Program to use all the ports as output ports.Address Label Mnemonics Operands Comments

2000 MVI A , 80HCWR specifies all the ports work as output ports.

2002 OUT 33H Load the value in CWR

2004 MVI A,99HLoad accumulator with 99H.

2006 OUT 30HDisplay the content of accumulator on PORTA

2008 OUT 31H Display the content of accumulator on PORT B

200A OUT 32HDisplay the content of accumulator on PORTC

200C MVI A,FFHLoad accumulator with FF H.

200E OUT 30HDisplay the content of accumulator on PORTA

2010 OUT 31H Display the content of accumulator on PORT

Page 34: Final Manual of Microprocessor

B

2012 OUT 32HDisplay the content of accumulator on PORTC

2014 JMP 2004Go back to 2004 and works as infinite loop.

10(b) Program to 2’s complement and display the result.

Address Label Mnemonics Operands Comments

2000 MVI A , 90HCWR specifies Port A as input and Port B and Port C as output

2002 OUT 33H Load the value in CWR

2004 IN 30HLoad the data from Port A into accumulator.

2006 CMAGet the complement of content of accumulator

2007 ADI 01H Add the content with 01H

2009 OUT 31HDisplay the content of accumulator on PORTB

200B OUT 32H Display the content of accumulator on PORTC

200D HLTDisplay the content of accumulator on PORTA

RESULT:

For all ports as output port

OUTPUT MEMORY LOCATION DATA

30H31H32H

Page 35: Final Manual of Microprocessor

For 2’s complement

INPUT MEMORY LOCATION DATA

30H

OUTPUT MEMORY LOCATION DATA

31H32H

Conclusion:

Page 36: Final Manual of Microprocessor

Experiment No: 11

Title: Write an assembly language program for Traffic light control using 8085 microprocessor.

Objective: To control the traffic light using 8085

Apparatus Required: 8085 Microprocessor trainer kit & Traffic light trainer kit.

Precautions: 1.Handle the kit carefully. 2. Write the instruction properly.

3. Load the address location between 00H to 03H.

Problem Solution: 1. 8255A on the kit is connected to traffic light trainer kit by using FRC cable2. port A of address location 00H is used for North to South direction

D7 D6 D5 D4 D3 D2 D1 D0GO LEFT GO STR START STOP GO LEFT GO STR START STOP

NORTH SOUTH

3. port C of address location 02H is used for East to West direction

D7 D6 D5 D4 D3 D2 D1 D0GO LEFT GO STR START STOP GO LEFT GO STR START STOP

EAST WEST

4.According to the coding the traffic light trainer kit works .

Program:1 [a] 8 bit addition:

Address Label Mnemonics Operands Comments2000 MVI A,80H PA & PB as output2002 OUT 03H2004 MVI A,11H Stop all four ends2006 OUT 00H2008 OUT 02H200A CALLDELAT1

200D LOOP MVI A,44HGo star signal of

North & South, Stop signal of East & West

200F OUT 00H

Page 37: Final Manual of Microprocessor

2011 CALLDELAY12014 MVI A,22H Alert signal for traffic2016 OUT 00H2018 CALLDELAY2

201B MVI A,99HGo left signal of north

& south201D OUT 00H201F CALLDELAY12022 MVI A,22H Alert signal2024 OUT 00H2026 CALLDELAY22029 MVI A,11H Stop signal for N to S202B OUT 00H

202D MVI A,44HGo strait signal for E

to W202F OUT 02H2031 CALLDELAY12034 MVI A,99H Go left for E to W2036 OUT 02H2038 CALLDELAY2203B MVI A,22H Alert203D OUT 02H203F CALLDELAY12042 MVI A,22H2044 OUT 02H2046 CALLDELAY22049 MVI A,11H Stop for E to W204B OUT 02H204D JMP LOOP Jump to loop2050 DELAY1 MVI B,25H Delay of 10 sec.2052 LP3 MVI C,FFH2054 LP2 MVI D,FFH2056 LP1 DCRD2057 JNZ LP1205A DCRC205B JNZ LP2205E DCRB205F JNZ LP32062 RET2063 DELAY2 MVI B,05H Delay of 2 sec.2065 LP6 MVI C,FFH2067 LP5 MVI D,FFH2069 LP4 DCRD206A JNZ LP4206D DCRC

Page 38: Final Manual of Microprocessor

206E JNZ LP52071 DCRB2072 JNZ LP62075 RET

Conclusion: