Msc Lab Manual-mp

  • July 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Msc Lab Manual-mp as PDF for free.

More details

  • Words: 6,422
  • Pages: 50
3.8-BIT MULTIPLICATION AND DIVISION AIM: To write an assembly language program to (i) Multiply two 8-bit numbers (ii) Divide two 8-bit numbers APPARATUS REQUIRED: 8085 Kit and Power supply ALGORITHM: 8-BIT MULTIPLICATION: 1. Initialize a register for carry. 2. Get the two input data (multiplier and multiplicand) from memory locations. 3. Clear accumulator for repeated addition and have multiplier as count. 4. Add multiplicand with accumulator content. 5. Check for carry. If carry =1, goto next step, else goto step 7. 6. Increment the carry register. 7. Decrement the count. 8. Check for count. If count=0, goto next step, else goto step 4. 9. Store the result and carry in memory locations. 10. Stop program execution. PROGRAM: Address 4101 4102 4103 4104 4105 4106

Opcode Label

4107 4108 4109 410A 410B 410C 410D

Mnemonics MVI C,00

Comments Move immediate 00 to C register

LDA 4500

Load accumulator with the content of Address 4500

MOV B,A

Move the content of B-register to Accumulator Load accumulator with the content of Address 4501

LDA 4501 MOV D,A L2

XRA A ADD B JNC L1

Move the content of D-register to Accumulator X-OR the content of accumulator Add the content of B register to accumulator content Jump if no carry to label location L1

410E 410F 4110 4111 4112 4113 4114 4115

INR C DCR D JNZ L2

Increment C register Decrenent D register Jump on no zero to label location L2

STA 4503

Store accumulator content to address 4503

4116 4117 4118

MOV A,C

4119

STA 4504

Move the content of C-register to Accumulator Store accumulator content to address 4504

411A 411B 411C

HLT

L1

Halt the program execution

ALGORITHM: 8-BIT DIVISION: 1. 2. 3. 4. 5. 6. 7. 8. 9.

Initialize a register for quotient. Get the two input data (divisor and dividend) from memory locations. Compare divisor and dividend. Check for carry, if set goto step 8, else to next step. Subtract divisor from dividend. Increment the quotient register. Go to step 3. Store the remainder and quotient in memory locations. Stop program execution.

PROGRAM: Address 4101 4102 4103 4104 4105 4106 4107 4108

Opcode Label

Mnemonics MVI C,00

Comments Move immediate 00 to C register

LDA 4500

Load accumulator with the content of Address 4500

MOV B,A

Move the content of B-register to Accumulator Load accumulator with the content of Address 4501

LDA 4501

4109 410A

L2

CMP B

410B 410C 410D 410E

JC L1

410F 4110 4111 4112 4113

INR C JMP L2

SUB B

L1

Compare B register content to accumulator content Jump on carry to label location L2 Subtract the content of B register from accumulator content Increment C register Jump to label location L2

STA 4503

Store accumulator content to address 4503

4114 4115 4116

MOV A,C

4117

STA 4504

Move the content of C-register to Accumulator Store accumulator content to address 4504

4118 4119 411A

HLT

Halt the program execution

PROCEDURE: 1. 2. 3. 4.

Key in the opcodes. Give the input data at specified memory locations. Execute the program. Check the results at specified output locations.

OBSERVATION : 8-bit Multiplication Input Output 8-bit Division Input Output

Address 4500 4501 4503 4504

Data 08 03 18 (Product LSB) 00 (Carry MSB)

Address 4500 4501 4503 4504

Data 08 03 02 (Remainder) 02 (Quotient)

Result: Thus the assembly language programs for 8-bit multiplication and division are written, executed and the results are verified.

FLOW CHART START

LOAD MULTIPLICANT AND MULTIPLIER TO ACT AS A COUNTER DATA IN A REG

LOAD A REG WITH 2ND DATA AND MOVE IT TO C REG

CLEAR D FOR CARRY A FOR ADDITION

ADD MULTIPLICANT REG WITH ACCUMULATOR

no

IF CY =0 yes

INCREMENT D REG

DECREMENT C REG

IF NO ZERO

yes

no

DECIMAL ADJUST THE CONTENTS OF ACCUMULATOR AND STORE PRODUCT IN MEMORY

STOP

FLOW CHART START

LOAD DENOMINATOR VALUE IN B REG

LOAD NUMERATOR VALUE IN A REG

CLEAR C REG

S UBTRACT THE VALUE OF B FROM A

INCREMENT THE QUOTIENT VALUE

COMPARE B REG WITH ACCUMULATOR

no

IF CY =1 yes

STORE QUOTIENT AND REMINDER IN MEMORY

S TOP

2.16-BIT ADDITION AND SUBTRACTION AIM: To write an assembly language program to (i) Add two 16-bit numbers (ii) Subtract two 16-bit numbers APPARATUS REQUIRED: 8085 Kit and Power supply 16-BIT ADDITION: ALGORITHM: 1. 2. 3. 4. 5. 6. 7. 8. 9.

Clear a register for carry. Get the LSBs of two 16-bit data. Add the LSBs and Store the result in memory location. Get the MSBs of two 16-bit data. Add the MSBs with carry of LSBs. Check for carry. If carry =1, goto next step, else goto step 7. Increment the carry register Store the result (MSBs sum) and carry in memory locations. Stop program execution.

PROGRAM: Address 4101 4102 4103

Mnemonics MVI C,00

Comments Move immediate 00 to C register

LHLD 4500

Load HL registers with the contents of Address 4500, 4501

4104 4105 4106

MOV B,L

4107

LHLD 4502

Move the content of L-register to B register Load HL registers with the contents of Address 4502, 4503

4108 4109

Opcode Label

410A

MOV A,L

410B

ADD B

410C

STA 4600

410D 410E 410F

MOV A,H

4110

ADC D

4111 4112 4113 4114 4115

JNC L1

Move the content of L-register to Accumulator. Add B register content to accumulator content Store accumulator content to address 4600 Move the content of H-register to Accumulator Add with carry, D register content to accumulator content Jump on no carry to label location L2

INR C STA 4601

Increment C register Store accumulator content to address 4601

4116 4117 4118

MOV A,C

4119

STA 4602

Move the content of C-register to Accumulator Store accumulator content to address 4602

411A 411B 411C

HLT

L1

Halt the program execution

16-BIT SUBTRACTION: ALGORITHM: 1. 2. 3. 4. 5. 6. 7. 8. 9.

Clear a register for carry. Get the LSBs of two 16-bit data. Subtract the LSBs and Store the result in memory location. Get the MSBs of two 16-bit data. Subtract the MSBs with borrow. Check for carry (borrow). If carry =1, goto next step, else goto step 7. Increment the carry register Store the result (MSBs difference) and carry in memory locations. Stop program execution.

PROGRAM: Address 4101 4102 4103 4104 4105 4106

Opcode Label

Mnemonics MVI C,00

Comments Move immediate 00 to C register

LHLD 4500

Load HL registers with the contents of Address 4500, 4501

MOV B,L

Move the content of L-register to B register Move the content of H-register to D register. Load HL registers with the contents of Address 4502, 4503

4107

MOV D,H

4108 4109 410A 410B

LHLD 4502

410C

SUB B

410D

STA 4600

410E 410F 4110

MOV A,H

4111

SBB D

4112 4113 4114 4115 4116

JNC L1

MOV A,L

Move the content of L-register to Accumulator Subtract B register content from accumulator content Store accumulator content to address 4600 Move the content of H-register to Accumulator Subtract with borrow,D register content from accumulator content Jump on no carry to label location L2

INR C STA 4601

Increment C register Store accumulator content to address 4601

4117 4118 4119

MOV A,C

411A

STA 4602

Move the content of C-register to Accumulator Store accumulator content to address 4602

411B 411C 411D

HLT

L1

Halt the program execution

PROCEDURE: 1. 2. 3. 4.

Key in the opcodes. Give the input data at specified memory locations. Execute the program. Check the results at specified output locations.

OBSERVATION : 16-bit Addition Input

Output

16-bit Subtraction Input

Output

Address 4500 4501 4502 4503 4600 4601 4602

Data 08 03 04 07 0C ( LSB Sum) 0A ( MSB Sum) 00 ( Carry)

Address 4500 4501 4502 4504 4600 4601 4602

Data 08 0A 09 0B 01 01 00

RESULT: Thus the assembly language programs for 16-bit addition and subtraction are written, executed and the results are verified.

4. 16-BIT MULTIPLICATION AND DIVISION AIM: To write an assembly language program (i) to multiply two 16-bit numbers and (ii) to divide two 16-bit numbers APPARATUS REQUIRED: 8085 Kit and Power supply ALGORITHM: 16-BIT MULTIPLICATION: 1. Initialize a register pair for carry. 2. Get the two 16-bit input data (multiplier and multiplicand) directly in register pairs. 3. Clear HL register pair for repeated addition and have multiplier as count. 4. Add multiplicand with HL register pair content. 5. Check for carry. If carry =1, goto next step, else goto step 7. 6. Increment the carry register. 7. Decrement the 16-bit count (Multiplier). 8. Check for count. If count=0, goto next step, else goto step 4. 9. Store the result and carry in memory locations. 10. Stop program execution. PROGRAM: Address 4101 4102 4103 4104

Opcode Label

Mnemonics LXI B,0000

Comments Load immediate 0000 to BC register pair

LHLD 4500

Load HL registers with the contents of Address 4500, 4501

4105 4106 4107

SPHL

4108

LHLD 4502

Move the content of HL-registers to stack pointer register. Load HL registers with the contents of Address 4502, 4503

4109 410A 410B

XCHG

Exchange the contents of HL and DE

410C 410D 410E 410F

LXI H,0000 L2

4110 4111 4112 4113 4114 4115

DAD SP JNC L1

L1

INX B DCX D MOV A,E

4116

ORA D

4117 4118 4119 411A

JNZ L2

register pairs Load immediate 0000 to HL register pair Add the content of stack pointer register to HL register pair Jump on no carry to label location L1 Increment BC register pair Decrement DE register pair Move the content of E-register to Accumulator Logigally OR the content of D register to accumulator Jump on no zero to label location L2

SHLD 4600

Store the contents of HL registers to address 4600,4601

411B 411C 411D

MOV L,C

411E

MOV H,B

411F

SHLD 4602

Move the content of C-register to L register Move the content of B-register to H register Store the contents of HL registers to address 4602,4603

4120 4121 4122

HLT

Halt the program execution

16-BIT DIVISION: ALGORITHM: 1. 2. 3. 4. 5. 6. 7. 8.

Initialize a register pair for quotient. Get the two 16-bit data (in HL pair and in a register pair). Save HL pair’s content to stack. Subtract the LSBs and Store the result in L-register. Subtract the MSBs with borrow. Check for carry (borrow). If carry =1, goto step 9, else goto next step. Increment the register pair for quotient. Store the result of subtraction in H-register. Goto step 3.

9. Store the Stack register content (Remainder) and quotient in memory locations. 10. Stop program execution PROGRAM: Address 4101 4102 4103 4104

Opcode Label

Mnemonics LXI D,0000

Comments Load immediate 0000 to DE register pair

LHLD 4500

Load HL registers with the contents of Address 4500, 4501

LXI B, 16bit data

Load immediate 16-bit data to BC register pair

4108 4109 410A

SPHL

Move the content of HL-registers to stack pointer register.

410B 410C 410D

MOV A.L SUB C MOV L,A

410E 410F

MOV A,H SBB B

4105 4106 4107

4110 4111 4112 4113 4114 4115

L2

JC L1

L1

INX D MOV H,A JMP L2

4116 4117 4118 4119 411A 411B 411C 411D

Load immediate 0000 to HL register pair Move the content of L-register to B register Add the content of stack pointer register to HL register pair Jump on no carry to label location L1 Increment BC register pair Decrement DE register pair Move the content of E-register to Accumulator Logigally OR the content of D register to accumulator Jump on no zero to label location L2

LXI H,0000 Store the contents of HL registers to address 4600,4601 DAD SP SHLD 4600

Store the contents of HL registers to address 4600,4601

411E 411F

XCHG

4120

SHLD 4602

4121 4122 4123

HLT

Move the content of B-register to H register Exchange the contents of HL and DE register pairs Store the contents of HL registers to address 4602,4603 Halt the program execution

PROCEDURE: 1. 2. 3. 4.

Key in the opcodes. Give the input data at specified memory locations. Execute the program. Check the results at specified output locations.

OBSERVATION : 16-bit Multiplication Input

Output

Address 4500 4501 4502 4503 4600 4601 4602 4603

Data 24(LSB1) 5A(MSB1) C2(LSB2) 47(MSB2) 48(LSB Product) 4B(LSB Product) 44(MSB Product) 19(MSB Product)

RESULT: Thus the assembly language program for 16-bit multiplication is written, executed and the results are verified.

5. (A) ARITHMETIC OPERATIONS USING BCD NUMBERS

AIM: To write an assembly language program to (i) Add and subtract two numbers of 2 digit (8-bit) BCD data. (ii) Perform bit manipulation using logical instructions APPARATUS REQUIRED: 8085 Kit and Power supply BCD ADDITION: ALGORITHM: 1. 2. 3. 4. 5. 6. 7. 8.

Initialize a register for carry. Get the two input data.(One data in accumulator and another in register) Add the two data. Restore the result in BCD. Check for carry. If carry =1, goto next step, else goto step 7. Increment the carry register. Store the result and carry in memory locations. Stop program execution.

PROGRAM: Address 4101 4102 4103

Opcode Label

Mnemonics MVI C,00

Comments Move immediate 00 to C register

LDA 4500

Load Accumulator with the content of Address 4500

4104 4105 4106

MOV B,A

4107

LDA 4501

Move the content of accumulator to B register Load Accumulator with the content of Address 4501

4108 4109 410A

ADD B

Add B register content to accumulator

410B 410C 410D 410E 410F 4110

DAA JNC L1

content Decimal Adjust Accumulator Jump on no carry to label location L1

INR C STA 4601

Increment C register Store accumulator content to address 4601

4111 4112 4113

MOV A,C

4114

STA 4602

Move the content of C-register to Accumulator Store accumulator content to address 4602

4115 4116 4117

HLT

L1

Halt the program execution

BCD SUBTRACTION: ALGORITHM: 1. Get the two input data.(Minuend in accumulator and Subtrahend in one register) 2. Take the 10’s complement of Subtrahend. 3. Add the two data. 4. Restore the result in BCD. 5. Store the result memory. 6. Stop program execution. PROGRAM: Address 4101 4102 4103 4104 4105 4106 4107

Opcode Label

Mnemonics LDA 4500

Comments Load Accumulator with the content of Address 4500

MOV B,A MVI A,99

Move the content of accumulator to B register Move immediate 00 to A register

SUB B

Subtract the content of B-register from

4108 4109

INR A MOV B,A

410A

LDA 4501

410B 410C 410D

ADD B

410E 410F

DAA STA 4601

4110 4111 4112

HLT

Accumulator content Increment A register content Move the content of accumulator to B registe Load Accumulator with the content of Address 4501 Add B register content to accumulator content Decimal Adjust Accumulator Store accumulator content to address 4601 Halt the program execution

BIT MANIPULATION: (CONVERTING BCD DATA TO BINARY NUMBER) ALGORITHM: 1. Get the BCD data in one register. 2. Mask the Units number (lower nibble) and get the ten’s number in a register. 3. Clear accumulator. 4. Load the count 10 in a register. 5. Add the Ten’s number to accumulator. 6. Decrement count. 7. Check for zero. if count=0, goto next step else goto step 5. 8. Save the product in a register. 9. Mask the ten’s number (upper nibble) of BCD data. 10. Add the units number in the above step to the product in step 8. 11. Store the binary value. 12. Stop program execution. PROGRAM: Address 4101 4102 4103 4104

Opcode Label

Mnemonics LDA 4500

Comments Load accumulator with the content of Address 4500

MOV E,A

Move the content of Accumulator to E

4105

ANI F0

4106 4107 4108 4109 410A 410B

RLC RLC RLC RLC MOV B,A

410C 410D 410E 410F

XRA A MVI C,0A L1

ADD B

4110 4111 4112 4113 4114

DCR C JNZ L1

4115

MOV A,E

4116

ANI 0F

4117

ADD B

4118

STA 4501

4119 411A 411B

HLT

MOV B,A

register AND immediate F0, with the content of accumulator Rotate accumulator left to carry Rotate accumulator left to carry Rotate accumulator left to carry Rotate accumulator left to carry Move the content of Accumulator to B register X-OR the content of accumulator Move immediate 0A to C register Add the content of B register to accumulator content Decrement C register Jump on no zero to label location L1 Move the content of Accumulator to B register Move the content of E register to Accumulator AND immediate 0F, with the content of accumulator Add the content of B register to accumulator content Store accumulator content to address 4501 Halt the program execution

PROCEDURE: 1. 2. 3. 4.

Key in the opcodes. Give the input data at specified memory locations. Execute the program. Check the results at specified output locations.

OBSERVATION : BCD Addition Input Output BCD Subtraction Input Output Bit Manipulation(BCD to Binary Conversion) Input Output

Address 4500 4501 4601 4602

Data 24 55 79 00

Address 4500 4501 4601

Data 24 55 31

Address

Data

4500 4501

45(BCD) 2D(Binary)

RESULT: Thus the assembly language programs for BCD Addition, BCD Subtraction and Bit manipulation (BCD to Binary conversion) are written, executed and the results are verified.

6.CODE CONVERSION AIM: To write an assembly language program to (i) Convert 8-bit Binary data to ASCII code (ii) Convert ASCII code to Binary number APPARATUS REQUIRED: 8085 Kit and Power supply BINARY TO ASCII: ALGORITHM: 1. Get the data in a register. 2. Mask the upper nibble of binary (Hex) data. 3. Call subroutine CODE to get ASCII code of the lower nibble and store in a memory. 4. Mask the lower nibble of binary(Hex) input data. 5. Rotate upper nibble to lower nibble position. 6. Call subroutine CODE to get ASCII code of the upper nibble and store in a memory. 7. Stop. ALGORITHM FOR SUBROUTINE “CODE”: 1. 2. 3. 4. 5.

Compare the nibble in Accumulator with 0A(Hex). If Carry=1, goto step 4, else goto next step. Add 07(Hex) to the nibble in Accumulator. Add 30(Hex) to the nibble in Accumulator. Return to main program.

PROGRAM: Address 4101 4102 4103 4104

Opcode Label

Mnemonics LDA 4200

Comments Load accumulator with the content of Address 4200

MOV B,A

Move the content of Accumulator to B register

4105

ANI 0F

AND immediate 0F, with the content of accumulator

CALL Code

Call the Subroutine labeled “Code”

STA 4201

Store accumulator content to address 4201

MOV A,B

Move the content of B register to accumulator AND immediate F0, with the content of accumulator

4106

ANI F0 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113

Code:

4114 4115 4116 4117 4118 4119 411A

L1

RLC RLC RLC RLC CALL Code

Rotate accumulator left to carry Rotate accumulator left to carry Rotate accumulator left to carry Rotate accumulator left to carry Call the Subroutine labeled “Code”

STA 4202

Store accumulator content to address 4202

HLT

Halt the program execution

CPI 0A

Compare immediate 0a with the content of accumulator

JC L1 ADI 07

Jump on carry to label location L1 ADD immediate 07, with the content of accumulator

ADI 30

ADD immediate 30, with the content of accumulator

RET

Return to main program

OBSERVATION : Binary(HEX) to ASCII Input Output

Address 4200 4201 4202

Data E4(HEX) 34(ASCII Code for 4) 45(ASCII code for E)

Result: Thus the assembly language programs for the code conversion (Binary to ASCII and ASCII to Binary) are written, executed and the results are verified. VIVA QUESTIONS: 1. 2. 3. 4. 5.

What is the difference between RLC and RAL? What are machine control instructions? How many machine cycles are required for STA 4500? What is T-State? What are I/O related instructions?

10.INTERFACING KEYBOARD/DISPLAY CONTROLLER TO 8085 AIM: To interface Keyboard/Display controller(8279) with 8085 processor and to display a particular string. ALGORITHM: (To display the string “HELLO”) 1. 2. 3. 4. 5.

Form the look up table. Move the control word to accumulator and out it through control register. Get the letters one by one from memory and out it. Check whether all letters are displayed. If not, display next character. Stop of program.

PROGRAM: ADDRESS 4500

OPCODE 21

LABEL

4501 4502 4503

00 46 3E

4504 4505 4506 4507

90 D3 01 7E

4508 4509 450A 450B

D3 00 23 7D

OUT 00

450C 450D 450E

FE 06 C2

CPI 06

450F 4510 4511

07 81 76

L1

MNEMONICS LXI H, 4600

COMMENTS Load immediate HL register pair with 4600

MVI A, 10

Move immediate 10 to accumulator

OUT 01

Out it through CR

MOV A,M

Move memory content to accumulator Out it through 8279 port

INX H MOV A,L

Increment HL register pair Move the content of L register to accumulator Compare immediate with 06

JNZ L1

Jump on no zero to label location L1

HLT

Halt the process

PROCEDURE: 1. Key in the opcodes. 2. Give the input data from look up table at the specified memory locations. 3. Execute the program and verify the character display. RESULT: The Keyboard/Display controller is interfaced with 8085 and the character display is verified.

FLOWCHART FOR KEYBOARD DISPLAY INTERFACING:

8. STRING MANIPULATION AIM:To Write A Program to move a block of data from one location to another location using processor 8085,To add an array of numbers APPARATUS REQUIRED: 8085 Kit and Power supply PROGRAM: Moving a block of data from one location to another: LXI H, add1 LXI B, add2 MVI D, count Loop1: MOV A,M STAX B INX H INX B DCR D JNZ Loop1 HLT Adding an array of data: LXI H, add MVI D,00 MOV C,M INX H MOV A,M Loop1: INX H MOV B,M ADD B

JNC Loop INR D Loop : DCR C JNZ Loop1 STA add1 MOV A,D STA add2 HLT OBSERVATION : MOVING A BLOCK Binary(HEX) to ASCII Input Output

Address 4200 4201 4202 4500 4501 4502

Data 02 08 09 02 08 09

Address 4200 4201 4202 4500

Data 02 08 03 OD

ADDING AN ARRAY Input Output

RESULT: Thus the assembly language programs for moving an array of data and adding an array of data are written, executed and the results are verified.

9 PROGRAMS FOR SORTING/ SEARCHING (USING 8085,8086) AIM:To Write A Program to sort the given numbers using 8085 and 8086 APPARATUS REQUIRED: 8085 Kit and Power supply PROGRAM: i) Sorting of an array of 8-bit numbers using 8085 LXI H,add1 MOV B,M MOV C,B Loop3: LXI H,add1 MOV D,B Loop2: MOV A,M INX H MOV B,M CMP B JC / JNC Loop1 MOV M,A DCX H MOV M,B INX H Loop1: DCR D JNZ Loop2 DCR C JNZ LooP3 HLT

ii) Searching a number in an array of data using 8085 MVI D,00 LXI H, add MOV C,M INX H MOV B,M Loop2: INX H MOV A,M CMP B JNZ Loop1 INR D Loop1: DCR C JNZ Loop2 MOV A,D STA add HLT

iii) Sorting an array of 8-bit numbers using 8086 MOV SI, add MOV BL, [SI] MOV DL,BL Loop3: MOV SI,add2 MOV DH, BL Loop2: MOV AL,[SI] INC SI MOV BH,[SI] CMP AL,BH JC/JNC Loop1

MOV [SI],AL DEC SI MOV [SI],BH INC SI Loop1: DEC DH JNZ Loop2 DEC DL JNZ Loop3 HLT

iv) Sorting an array of 16-bit number using 8086 MOV SI, add MOV BL, [SI] MOV DL,BL Loop3: MOV SI,add2 MOV DH, BL Loop2: MOV AX,[SI] INC SI INC SI MOV CX,[SI] CMP AX,BX JC/JNC Loop1 MOV [SI],AX DEC SI DEC SI MOV [SI],CX INC SI INC SI Loop1: DEC DH

JNZ Loop2 DEC DL JNZ Loop3 HLT

OBSERVATION: SORTING: Address 4200 4201 4202 4203 4500 4501 4502 4503

Data 02 08 03 09 02 03 08 09

SEARCHING:TO SEARCH 02 Address Input 4200 4201 4202 4203 Output 4500

Data 02 08 03 09 02

Input

Output

RESULT: Thus the assembly language programs for sorting and searching in an array of data are written, executed and the results are verified

13.INTERFACING & PROGRAMMING 8259 Interfacing 8259 with 8085 microprocessor AIM:To interface 8259 with microprocessor ALGORITHM: Initialize 8259 with the following specifications: ICW4 needed, single 8259, Interval of ------(8085), Edge triggered mode, Vector address(8085)/ Type number(8086) of IR0 ------, ------- mode, Normal EOI, Nonbuffered mode, Not special fully nested mode, Mask all interrupts except ---------. A0 – Address with A0 = 0 A1 – Address with A0 = 1 1.Initialize 8259 for the given specification 2.Send ICW1 to A0 3.Send ICW2 to A1 4.Send ICW4 T0 A1 5.Send OCW1 to A1 6.Send OCW2 To A0

Using 8085: MVI A, ICW1 OUT A0 MVI A,ICW2 OUT A1 MVI A,ICW4 OUT A1 MVI A,OCW1 OUT A1 HLT

ISR:

MVI A,OCW2

; Non-specific EOI command

OUT A0 HLT

RESULT:Thus 8259 is interfaced with 8085

MODE 2: KIT 1: MVI A,C0

;Control word to set PA in mode2

OUT CR LOOP:

IN PC

; Check the status of OBF

ANI 90 JZ LOOP MVI A, DATA

; Transfer data

OUT PA LOOP1:

IN PC

; Check the status of IBF

ANI 20 JZ LOOP1 IN PA

; Get data

STA ADD HLT KIT2: MVI A, C0

; Control word to set PA in mode2

OUT CR LOOP:

IN PC

; check the status of IBF

ANI 20 JZ LOOP IN PA

; get data

STA ADD LOOP1:

IN PC

; Control word to set PA in mode2

ANI 90 JZ LOOP1 MVI A, DATA OUT PA HLT

; Transfer data

11.

REVERSING AN ARRAY OF DATA

AIM: To write an assembly language program to perform reversing an array of elements. APPRATUS REQUIRED: 8085 KIT

ALGORITHM: 1. Load the HL register pair with some data in 4200 2. Load the BC register pair in 4300 3. Move immediately the data 05H to the register D. 4. Move the C-register value to the accumulator. 5. Add the content of the accumulator with D-register. 6. Move the accumulator content to the C-register. 7. Decrement the content of the BE-register pair. 8. Move the content of M to the accumulator. 9. Store the content of the BC-register pair. 10. Increment the content of the HL-register pair. 11. Decrement the content of the BC-register pair. 12. Decrement the content of D-register. 13. If no zero jump to the loop. 14. Stop the process. PROGRAM:

Reversing An Array Of Elements: ADDRESS

HEXCODE

LABEL

4100

21,00,42

LXI

H,4200

4103

D1,00,43

LXI

B,4300

4106

16,05

MVI

D,05

4108

79

MOV

A,C

4109

82

ADD

D

410A

4F

MOV

C,A

410B

0B

DCX

B

410C

7E

MOV

A,M

Loop

MNEMONICS

OPERAND

COMMENTS

Load the HL pair with some data in 4200 Load the BC pair in 4300 Move immediately the data 05H to D register Move the C-register value to the A Add the content of D with Accumulator Move the accumulator content to the C-register Decrement the content of the BE-register pair Move the content of M

410D

02

STAX

B

410E

23

INX

H

410F

0B

DCX

B

4110

15

DCR

D

4111

62,0C,41

JNC

Loop

4114

76

HLT

to the accumulator Store the content of the BC-register pair Increment the content of the HL-register pair Decrement the content of the BC-register pair. Decrement the content of D-register. If no carry jump to the loop. Stop the process.

PROCEDURE::

1. Key in opcode from the specified location. 2. Enter the data into the memory and execute the program. 3. Check for the result and stop the program. RESULT:

Thus reversing an array of element is executed successfully and the output is verified. CONTENT

ADDRESS FIELD INPUT FIELD 4200 4201 4202 4203 4204

DATA FIELD 01H 02H 03H 04H 05H

4300 4301 4302 4303 4304

05H 04H 03H 02H 01H

OUTPUT FIELD

FLOWCHART Start

Load the HL,BC register address 4200&4300

Move the data 05H to the D-Register

Move the contents of C to accumulator

Add the content of D-register with A

Move the contents of A to the C-register

Decrement BE-register pair

Move the content of M to the accumulator

Store in BC-register pair

Increment the content of the HL-register pair

Decrement the BC-register pair and D reg

NO

If CY=1 YES Stop

FLOWCHART FOR REVERSING AN ARRAY OF ELEMENTS

1.ADDITION OF TWO 8 BIT NUMBERS AIM: To write a program for adding the given two 8- bit number and store the result in the memory . APPARATUS REQUIRED: Microprocessor :Intel 8085 Operating Frequency :3.012MHz User RAM Area :4100-5FFF

ALGORITHM: 1. Load the accumulator by data in the address 4200H 2. Move the contents of the accumulator to B Register 3. Load the accumulator by data in the address 4201H 4. Clear C Register 5. Add the content of the accumulator to B Register content 6. If no carry jump to loop 7. Increment C Register 8. Shift the content of the accumulator to the location 4203 9. Move the contents of the C Register to accumulator. 10. Shift the content of the accumulator to the location 4204 11. Halt the current Program

PROGRAM:

ADDRESS

HEX CODE

LABEL

MNEMONICS

OPERAND

4100

3A,00,42

LDA

4200

4103

47

MOV

B,A

4104

3A,01,42

LDA

4201

4107

0E,00

MVI

C,00

4109

80

ADD

B

410A

D2,0E,41

JNC

loop

410D

0C

INR

C

410E

32,02,42

STA

4202

Loop 4111

79

MOV

A,C

4112

32,03,42

STA

4203

4115

76

HLT

COMMENTS

Load the accumulator with data in 4200 Move the contents of the accumulator to B Register Load the accumulator with data in 4201 Clear C Register Add the content of the B Register to accumulator. If no carry jump to loop Increment C Register Shift the content of the accumulator to the location 4202 Move the contents of the C Register to the accumulator. Shift the content of the accumulator to the location 4203 Stop the current Program

PROCEDURE: 1. Key in opcode from the address specified 2. Enter data to 4200, 4201. 3. Execute the program and check the result at 4202 and 4203. RESULT: Thus the 8-bit addition with carry is performed. CONTENT INPUT FIELD

ADDRESS FIELD

DATA FIELD

4200 4201

04H 09H

4202 4203

0DH 00H

OUTPUT FIELD

11.INTERFACING STEPPER MOTOR WITH 8086 USING 8255 AIM: To write an assembly language program to interface stepper motor with 8086. APPARATUS REQUIRED: 8086 microprocessor kit Key board Stepper motor Stepper motor Interface Board THEORY: A motor in which the rotor is able to assume only discrete stationary angular position is a stepper motor. The basic two-phase motor has two pairs of stator poles with its own windings. The excitation of any one winding generates a north and South Pole gets induced at the diametrically opposite sides. The stator frame is continuous and magnetic field passes through the cylindrical annular ring. The rotor magnetic system has two end faces. The left face is magnetized permanently as south pole and right face as north pole. North pole structure is twisted with respect to south pole structure such that south pole comes in between two north poles.Step angle is the minimum degree of rotation associated with single step. Revolution is the number of steps needed to complete one rotation or 360 degree. STEP SEQUENCE – 2 PHASE SCHEME Anti Clockwise Rotation Step A1 A2 B1 B2

Valu e

Clockwise Rotation A1 A2 B1 B2

Value

1.

1

0

0

1

09

1

0

1

0

0A

2.

0

1

0

1

05

0

1

1

0

06

3.

0

1

1

0

06

0

1

0

1

05

4.

1

0

1

0

0A

1

0

0

1

09

ALGORITHM: 1. Load the stepping sequence in DI register 2. Move the count value to CL register. 3. Move the contents of destination index to AL. 4. Output the loaded values between delay 5. Decrement the contents of DX register 6. If no zero jump to the L1 7. Increment destination index register. 8. Loop to loop1. 9. Move the delay value to BX register. 10. Decrement the contents of BX register 11. If no zero jump to L2. 12. Jump to beginning address 13. Stop the program. 14. Load the look up table values before execution

PROGRAM: Start: MOV DI,1200 MOV CL,04 Loop1:MOV AL,[DI] OUT C0,AL L1:

MOV DX,1010 DEC DX JNZ L1 INC DI LOOP LOOP1 MOV BX,0FFF

L2:

DEC BX JNZ L2 JMP Start HLT PROCEDURE: 1.Key in the code from the address specified 2Enter the count value and enter the look up table value at the specified address 3.Execute the program and check the result.

RESULT: Thus program to perform stepper motor interface with 8086 was executed and verified.

FLOWCHART FOR STEPPER MOTOR STAR T

STORE STEP SEQUENCE IN DI REGISTER AND SET COUNT VALUE MOVE VALUES IN LOOK UP TABLE SEQUENTIALLY TO OUTPUT PORT

CALL DELAY & INCREMENT DI REGISTER

IF DI>Cou nt

CALL DELAY

STOP

13.SQUARE WAVE GENERATION USING 8253 INTERFACE WITH 8086 AIM: To write an assembly language program to generate a square wave using 8253 interfacing with 8086 processor. APPARATUS REQUIRED: 8086 microprocessor kit Key board 8253 Interface Board THEORY: 8253 acts as Timer/Counter. It generates accurate time delays and square waves. contains three 16 bit independent counters. The device has 6 different counting modes including square wave generation and monostable operation. Control word: 0 D7

0

1

1

0

1

D7:D6 - Counter 0 D5:D4 - LSB first MSB next D3:D1 - Square wave rate generator D0

- Binary Code

1

0 D0

Divisor Value: Divisor Value = Clock frequency of Counter0 Desired Frequency ALGORITHM: 1. Load the Control word 2. Output the value through the port 3. Load the divisor value to count the specific frequency (LSB value) 4. Output the value through the port 5. Load the divisor value to count the specific frequency (MSB value) 6. Output the value through the port 7. Stop the program.

PROGRAM: MOV AL,36 OUT 16,AL MOV AL,0A OUT 10,AL MOV AL,00 OUT 10,AL HLT PROCEDURE: 1. Key in the code from the address specified 2. Load the control word for specific frequency 3. Execute the program and check the result. RESULT: Thus the square wave was generated by interfacing 8086 with 8253 and the program was executed and verified.

14.TRAFFIC CONTROLLER USING 8255 WITH 8085 AIM: To write an assembly language program to do traffic signal controller and store result in memory. APPARATUS REQUIRED: Microprocessor : INTEL 8085 Operating frequency : 3.102 MHZ User RAM area : 4100-5FFFH ALGORITHM: 1. Load the HL-register pair, move the data OC to C-register. 2. Move the pair to A-register, out the counter 3. Increment HL pair, move HL pair to A-register. 4. Out the port A, increment HL pair. 5. Move the HL pair to A-register, out port B, call delay. 6. Increment HL pair, decrement C register. 7. If no jump to loop1, jump to start. 8. Push B, initialize 05 to C-register. 9. Move D-register to accumulator 10. OR the E-register 11. If no jump to loop, decrement C register. 12. If no jump to loop, pop the B-register. 13. Return. PROGRAM: ADDRESS

HEXCODE

LABEL

4100

21,00,45

Start

MNEMONICS

OPERAND

LXI

H,4500

COMMENTS

Load the HL-register pair

4103 4105

OE,OC 7E

MVI MOV

C,OC A,M

4106 4108 4109

D3,OF 23 7E

OUT INX MOV

CNT H A,M

410A 410C 410D

D3,OC 23 7E

OUT INX MOV

A H A,M

410E 4110 4113 4114 4115 4118 411B 411C 411E 4121 4122

D3,OD CD,1B,41 23 OD C2,09,41 C3,00,41 C5 OE,05 11,FF,FF 1B 7A

OUT CALL INX DCR JNZ JMP PUSH MVI LXI DCX MOV

B Delay H C LOOP1 Start B C,05 D,FF,FF D A,D

4123 4124 4127 4128 412B 412C

B3 C2,21,41 OD C2,1E,41 C1 C9

ORA JNZ DCR JNZ POP RET

E Loop2 C Loop3 B

Loop1

Delay Loop3 Loop2

Move data OC to C register Move HL contents to accumulator Count the value Increment HL pair Move the content of M to A-register Out A port Increment HL register pair Move the content of M to accumulator Out B port Call the Delay Increment HL pair Decrement the C register If no zero jump to loop Jump to Start Push B register Move data 05 to C register Load the DE-pair Decrement D-register Move D-register to accumulator OR the E-register If no zero jump to Loop2 Decrement C-register If no zero jump to Loop3 Pop the B-register Return

PROCEDURE: 4. Key in opcode from the specified location. 5. Enter the data in 4500 to 4508. RESULT: Thus the traffic signal controller is carried out. CONTENT Input field

ADDRESS FIELD 4500

DATA FIELD 80,1A,A1,64, A4,81,5A,64,54

5.(B)BCD MULTIPLICATION AIM: To write a program for multiplying the given two 8-bit BCD number and store the result in the memory. APPARATUR REQUIRED: Microprocessor :Intel 8085 Operating Frequency :3.012MHz User RAM Area :4100-5FFF ALGORITHM: 1. Load the accumulator by data in the address 4200H 2. Move the contents of the accumulator to B Register 3. Load the accumulator by data in the address 4201H 4. Move the contents of the accumulator to C Register 5. Clear D Register and Accumulator 6. Add the content of the accumulator to B Register content 7. Adjust for decimal 8. If no carry jump to loop 9. Increment D Register 10. Decrement C Register 11. Jump on no zero to loop1 12. Store the content of the accumulator to the desired location 13. Move the contents of the D Register to accumulator 14. Store the content of the accumulator to the desired location 15. Halt the current Program

PROGRAM:

PROCEDURE: HEX CODE

ADDRESS

LABEL

MNEMONICS

OPERAND

4100

3A,00,42

LDA

4200

4103

47

MOV

B,A

4104

3A,01,42

LDA

4201

4107

4F

MOV

C,A

4108 4109

AF 16,00

XRA MVI

A D,00

410B

80

ADD

B

410C

27

DAA

410D

D2,11,41

JNC

Loop

4110 4111 4112 4115

14 0D C2,0B,41 32,02,42

INR DCR JNZ STA

D C Loop1 4202

4118

7A

MOV

A,D

4119

32,03,42

STA

4203

411C

76

HLT

Loop1

Loop

COMMENTS

Load the accumulator with data in 4200 Move the contents of the accumulator to B Register Load the accumulator with data in 4201 Move the contents of the accumulator to C Register Clear A register Clear D register Add the contents of B register to A Decimal adjust the contents of accumulator Jump to given location if there is no carry Increment the D register Decrement the C register Jump on no zero to Loop1 Store the content of A to the location 4202 Move the contents of the to D Register to accumulator Store the content of A to the location 4202 Stop the current Program

1. Key in opcode from the address specified 2. Enter data to 4200, 4201. 3. Execute the program and check the result at 4202 and 4203. RESULT: Thus the 8-bit BCD multiplication is performed. CONTENT

ADDRESS FIELD

DATA FIELD

4200 4201

04H 03H

4202 4203

12H 00H

INPUT FIELD

OUTPUT FIELD

Related Documents

Msc Lab Manual-mp
July 2020 6
Msc
December 2019 35
Msc
October 2019 38
Msc
November 2019 30
Msc Bremen.pdf
June 2020 11
Msc Biotechnology
July 2020 10