Sunteți pe pagina 1din 102

Exp no: 1 Date : PROGRAMMING WITH 8085 8 BIT ARITHMETIC OPERATION AIM: To write an assembly language program for

r arithmetic operations of two 8 bit numbers using 8085 microprocessor kit for the following operations. A. B. C. D. Addition Subtraction Multiplication Division

APPARATUS REQUIRED: S.No 1. 2. 3. Apparatus Required 8085 Microprocessor kit Power supply Opcode sheet Quantity 1 1

A. ALGORITHM FOR 8-BIT ADDITION: 1. 2. 3. 4. Start the program. Load first data in accumulator and move the content from register A to register B. Load the second data in accumulator. Initialize the carry value as 00. Add the content of A register with B register. If a carry doesnt exist, directly store the value. 5. If carry exists, then increment the carry value and then store the sum in the address location mentioned. 6. Stop the program.

FLOW CHART FOR 8 BIT ADDTION:


Start

Clear the C register

Load the contents of memory into accumulator

Move the contents of accumulator to B register

Load the contents of memory to accumulator

Add the contents of B-register with accumulator

IF ther e carr

No

Increment the C register

Store the contents of accumulator to memory

Move the contents of C register to accumulator

Store the contents of accumulator to memory

Stop

PROGRAM FOR 8-BIT ADDITION: MEMORY LABEL 4500 START 4501 4502 4503 4504 4505 4506 4507 4508 4509 450A 450B 450C 450D 450E 450F 4510 4511 4512 4513 4514 4515 MNEMONICS OPCODE MVI C,00H 0E 00 LDA 4200H 3A 00 42 MOV B,A 47 LDA 4201H 3A 01 42 80 D2 0E 41 0C 32 02 42 79 32 03 42 76 COMMENTS Move the value to register C immediately Load accumulator from address 4200H Move the content to the B register Load accumulator from address 4201H Add contents of B with A Jump of control to given address when no carry is found Increment register C Store accumulator with contents of 4202H Move content of C to A Store accumulator with contents of 4203H Stop the program

ADD B JNC LOOP1

LOOP1

INR C STA 4202H

MOV A,C STA 4203H

STOP

HLT

B. ALGORITHM FOR 8 BIT SUBTRACTION: 1. Load the first data in accumulator and move the content from accumulator to B register. 2. Load the second data in accumulator. Initialize the carry value. 3. Subtract the content of accumulator with register B. 4. Check whether carry is present or not. 5. If present, increment the carry. 6. Complement the accumulator content. 7. Add immediate by incrementing A register. 8. If no carry is present, store the data in accumulator. 9. The content present in C register is moved to accumulator. 10. Store the result in memory location mentioned. 11. Stop the program.

FLOW CHART FOR 8 BIT SUBTRACTION:

PROGRAM FOR 8 BIT SUBTRACTION: MEMORY 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 460A 460B 460C 460D 460E 460F 4610 4611 4612 4613 4614 4615 4616 4617 LABEL START MNEMONICS OPCODE MVI C,00 0E 00 LDA 4200H 3A 00 42 47 3A 01 42 90 D2 10 46 0C 2F 3C 32 02 42 79 32 03 42 76 COMMENTS Move the value to register C immediately Load accumulator from address 4200H Move content of A to B Load accumulator from address 4201H Subtract contents of B with A Jump of control to given address when no carry is found Increment register C Complement occurs Increment of A Store the content of given address to accumulator Move contents of C to A Store the content of given address to accumulator
Stop the program

MOV B,A LDA 4201H

SUB B JNC LOOP1

LOOP1

INR C CMA INR A STA 4202H

MOV A,C STA 4203H

STOP

HLT

ALGORITHM FOR 8-BIT MULTIPLICATION: 1. Start the program. 2. Load the first data into the accumulator. 3. Move the content of accumulator to the B register. 4. Load the second data into the accumulator. 5. Move the content of accumulator to the C register. 6. Decrement the content of B register by one. 7. Add the C register content with accumulator. 8. Decrement the content of B register & then repeat the steps 7 & 8. 9. Else store the result in the memory location mentioned. 10. Stop the program.

FLOW CHART FOR 8 BIT MULTIPLICATION:

PROGRAM FOR 8 BIT MULTIPLICATION: MEMORY 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 LABEL START MNEMONICS OPCODE MVI C,00H 0E 00 LDA 4200H 0A 00 41 MOV B,A 47 LDA 4201H 0A 01 41 MOV C,A 4F DCR B 05 ADD C 81 DCR B 05 JNZ LOOP C2 0B 41 STA 4202H 32 02 42 HLT 76 COMMENTS Move the content immediately to reg C Load accumulator from address 4200H Move content of A to B Load accumulator from address 4201H Move content of A to C Decrement register B Add content of C with A Decrement register B Jump of control to given address when no zero is found Store the content of given address to accumulator Stop the program

LOOP

ALGORITHM FOR 8 BIT DIVISION: 1. 2. 3. 4. 5. Start the program. Load the first data in the accumulator. Move the content from memory address to A register and increment the HL pair. Move the content from memory address to B register & initialize the C register. Compare the 8 bit instructions in A and B registers. Subtract B register from accumulator & increment the value in C register. 6. Increment the HL pair and move the content in accumulator to memory. 7. Stop the program

FLOW CHART FOR 8 BIT DIVISION:

PROGRAM FOR 8 BIT DIVISION: MEMORY 4201 4202 4203 4204 4205 4206 4207 4208 4209 420A 420B 420C 420D 420E 420F 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 421A LABEL START MNEMONICS OPCODE MVI C,00H 0E 00 LDA 4500H 3A 00 45 MOV B,A 47 LDA 4501 3A 01 45 CMP B B8 JC LOOP2 DA 13 42 SUB B 90 INR C 0C JMP LOOP1 C3 0A 42 STA 4502H 32 02 45 MOV A,C 79 STA 4503 32 03 45 HLT 76 COMMENTS Move the content immediately to reg C Load the content to the accumulator with the address 4500 Move the content to reg B Load the content to the accumulator with the address 4501 Compare the B reg Jump carry to loop2

LOOP 1

Subtract the reg B Increment reg C Jump to loop1

LOOP2

STOP

Store the content to the accumulator with the address 4502 Move the content to A Store the content to the accumulator with the address 4503 Halt the process

Exp no: 2 Date : PROGRAM WITH 8085 CONTROL INSTRUCTIONSASCENDING/DESCENDING ORDER

AIM: To write an assembly language program for the ascending and descending order of 8-bit numbers using 8085 microprocessor kit. APPRATUS REQUIRED: S.NO 1. 2. NAME OF ITEMS 8085-Microprocessor kit Power supply QUANTITY 1

A. ALGORITHM FOR ASCENDING ORDER: 1. Start the program 2. Load the data in memory whose address in C 3. Move the memory into C-register then decrement the C-register by 1 and increment H by 1. 4. Load the data in the memory to A. 5. Compare the memory with A. 6. Jump on the carry when M is greater A, go to Step 9. 7. Move the memory M to D register 8. Decrement the address of HL pair and move the D register content to M and increment the value by H by 1. 9. Move B register and decrement the C-register. 10. Jump on Zero to the address 4108,if zero goes to decrement B and go to step1. 11. Stop the program.

FLOW CHART FOR ASCENDING ORDER:

PROGRAM FOR ASCENDING ORDER: ADDRESS 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B 411C OPCODE 06 05 05 0E 05 0D 21 00 42 7E 23 BE DA 14 41 56 77 2B 72 23 0D C2 09 41 05 C2 03 41 76 LABEL START MNEMONICS MVI B,05H DCR B MVI C,05H DCR C LXI H,4200 COMMENTS Move the content immediately to reg B Decrement the reg B Move the content immediately to reg c Decrement the reg C Load the content immediately to HL pair Move the content to A Increment the HL pair Compare the contents Jump carry to loop3 MOV D,M MOV M,A DCX H MOV M,D INX H DCR C JNZ LOOP2 Move the content to D Move the content to memory Decrement the HL pair Move the content to memory Increment the HL pair Decrement the reg C Jump non zero to loop2 DCR B JNC LOOP1 Decrement the reg B Jump no carry to loop1 STOP HLT Halt the process

LOOP1

LOOP2

MOV A,M INX H CMP M JC LOOP3

LOOP3

B. ALGORITHM FOR DESCENDING ORDER: 1. Start the program 2. Load the data in memory whose address in C 3. Move the memory into C-register then decrement the C-register by 1 and increment H by 1. 4. Load the data in the memory to A. 5. Compare the memory with A. 6. Jump on no carry when M is greater A, go to Step 9. 7. Move the memory M to D register 8. Decrement the value of HL pair and move the D register content to M and increment the value by H by 1. 9. Move B register and decrement the C-register. 10. Jump on Zero to the address 4108,if zero goes to decrement B and go to step1. 11. Stop the program.

FLOW CHART FOR DESCENDING ORDER:

PROGRAM FOR DESCENDING ORDER: ADDRESS 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B 411C OPCODE 06 05 05 0E 05 0D 21 00 42 7E 23 BE D2 14 41 56 77 2B 72 23 0D C2 09 41 05 C2 03 41 76 MOV D,M MOV M,A DCX H MOV M,D INX H DCR C JNZ LOOP2 Move the content to D Move the content to memory Decrement the HL pair Move the content to memory Increment the HL pair Decrement the reg C Jump non zero to loop2 DCR B JNC LOOP1 Jump no carry to loop1 STOP HLT Halt the process Decrement the reg B LABEL START MNEMONICS MVI B,05H DCR B MVI C,05H DCR C LXI H,4200 COMMENTS Move the content immediately to reg B Decrement the reg B Move the content immediately to reg c Decrement the reg C Load the content immediately to HL pair Move the content to A Increment the HL pair Compare the contents Jump non carry to loop3

LOOP1

LOOP2

MOV A,M INX H CMP M JNC LOOP3

LOOP3

Exp no: 3 Date : PROGRAM WITH 8085 CONTROL INSTRUCTIONS AIM: To write an assembly language program for the Maximum/Minimum instructions using 8085 microprocessor kit. APPRATUS REQUIRED: S.NO 1. 2. NAME OF ITEMS 8085-Microprocessor kit Power supply QUANTITY 1

A. ALGORITHM FOR SEARCHING MINIMUM NUMBER: 1. Start the program 2. Load the address of the first element of the array in the HL register fair(pointer). 3. Move the count to B register. 4. Increment the pointer. 5. Get the first data in accumulator. 6. Decrement the count. 7. Increment the pointer. 8. Compare the content of memory address by HL pair with that of accumulator. 9. If carry=1 go to step 2 or If carry=0 go to step 10. 10. Move the content of memory addressed by HL to accumulator. 11. Decrement the count. 12. Check whether ZF=0 go to step 7 or If ZF=1 go to next step. 13. Store the smallest data in memory. 14. Stop the program.

FLOW CHART FOR SEARCH THE MINIMUM NUMBER:

PROGRAM FOR SEARCHING MINIMUM NUMBER ADDRESS 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 OPCODE 21 00 45 46 23 7E 05 23 BE DA 0D 41 7E 05 C2 07 41 32 04 45 76 LABEL START MNEMONICS LXI H,4500 Load the content immediately to HL pair MOV B,M INX H MOV A,M L2 DCR B INX H CMP M JC L1 Move the content to reg B Increment the HL pair Move the content to A Decrement the reg B Increment the HL pair Compare the memory to A Jump carry to L1 MOV A,M DCR B JNZ L2 Move the content to reg A Decrement the reg B Jump non zero to L2 STA 4504 Store the value to A STOP HLT Halt the process COMMENTS

L1

B. ALGORITHM FOR SEARCHING MAXIMUM NUMBER: 1. Start the program 2. Load the address of the first element of the array in the HL register fair (pointer). 3. Move the count to B register. 4. Increment the pointer. 5. Get the first data in accumulator. 6. Decrement the count. 7. Increment the pointer. 8. Compare the content of memory address by HL pair with that of accumulator. 9. If carry=0 go to step 2 or If carry=0 go to step 10. 10. Move the content of memory addressed by HL to accumulator. 11. Decrement the count. 12. Check whether ZF=0 go to step 7 or If ZF=1 go to next step. 13. Store the smallest data in memory. 14. Stop the program.

FLOW CHART FOR SEARCH THE MAXIMUM NUMBER

PROGRAM FOR SEARCHING MAXIMUM NUMBER: ADDRESS 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 OPCODE 21 00 45 46 23 7E 05 23 BE D2 0D 41 7E 05 C2 07 41 32 04 45 76 LABEL START MNEMONICS LXI H,4500 Load the content immediately to HL pair MOV B,M INX H MOV A,M L2 DCR B INX H CMP M JNC L1 Move the content to reg B Increment the HL pair Move the content to A Decrement the reg B Increment the HL pair Compare the memory to A Jump non carry to L1 MOV A,M DCR B JNZ L2 Move the content to reg A Decrement the reg B Jump non zero to L2 STA 4504 Store the value to A STOP HLT Halt the process COMMENTS

L1

Exp no: 4 Date : PROGRAM WITH 8085 CONTROL INSTRUCTIONS AIM: To write an assembly language program for the Code conversion using 8085 microprocessor kit. APPRATUS REQUIRED: S.NO 1. 2. NAME OF ITEMS 8085-Microprocessor kit Power supply QUANTITY 1

a. ALGORITHM FOR BCD TO BINARY: 1. Start the program. 2. Get the BCD data in A register and move to B register. 3. Mask the lower nibble of BCD data in A register. 4. Rotate the upper nibble to lower nibble position and save in B register. 5. Clear the accumulator. 6. Move 0AH to C register. 7. Add B register to A register. 8. Decrement C register If ZF=0 go to step 7 If ZF=1 go to next step. 9. Save the product in B register. 10. Get the BCD data in A register. 11. Add the units (A reg) to product (B reg). 12. Store the binary value in memory. 13. Stop the program.

FLOW CHART FOR CODE CONVERSION: (BCD TO BINARY)

PROGRAM FOR BCD TO BINARY: ADDRESS 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B OPCODE 3A 00 45 47 E6 0F 5F 78 E6 F0 0F 0F 0F 0F 57 A7 26 0A 84 15 C2 12 41 83 82 01 45 76 LABEL START MNEMONICS LDA 4500 Load the content to A MOV B,A ANI OF MOV E,A MOV A,B ANI FO RRC RRC RRC RRC MOV D,A XRA A MVI H,OA L1 ADD H DCR D JNZ L1 Move content to reg B And the content immediately with accumulator Move content to reg E Move content to reg A And the content immediately with accumulator Rotate A to right with carry Rotate A to right with carry Rotate A to right with carry Rotate A to right with carry Move content to reg D XOR function with A Move immediately to reg H Add the reg H Decrement the reg D Jmp non zero to L1 ADD E STA 4501 Add to reg E Store the content to A STOP HLT Halt the process COMMENTS

b. ALGORITHM FOR BINARY TO BCD 1. Start the program. 2. Clear D &E register to account for hundreds and tens. 3. Load the BINARY data in A register 4. Compare A register with 64H If carry flag set go to step 8 otherwise go to next step. 5. Subtract 64H from A register. 6. Increment E register. 7. Go to step 4. 8. Compare A register with 0AH If carry flag set go to step 11 otherwise go to next step. 9. Subtract 0AH from A register. 10. Increment D register 11. Go to step 8. 12. Combine the units and tens to form 8 bit result. 13. Save the units, hundreds and tens in memory. 14. Stop the program.

FLOW CHART FOR CODE CONVERSION: (BINARY TO BCD)

PROGRAM FOR BINARY TO BCD: ADDRESS OPCODE LABEL 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B 411C 411D 411E 411F 4120 4121 4122 4123 31 00 47 21 00 45 7E CD 0B 41 76 21 00 46 06 64 CD 1A 41 06 0A CD 1A 41 77 C9 36 FF 34 90 D2 1C 41 80 23 C9 START

MNEMONICS LXI SP,4700

COMMENTS Load the data to stack pointer

LXI H,4500 Load the data to HL MOV A,M CALL SUB R1 Move the data to A Call the sub function SUB R1 HLT LXI H,4600 Halt the process Load the data to HL MVI B,64H CALL SUB R2 Move the data to regB Call the sub function SUB R2 Move the data to regB Call the sub function SUB R2 Move the data to M Return Move the data to M Increment memory register Subtract reg B from A Jump no carry to L1 ADD B INX H RET Add A to B Increment reg H Return

SUB R1

MVI B,0AH CALL SUB R2

MOV M,A RET SUB R2 L1 MVI M,FFH INR M SUB B JNC L1

Exp no: 5 Date : PROGRAMMING WITH 8085 16 BIT ARITHMETIC OPERATION AIM: To write an assembly language program for arithmetic operations of two 16 bit numbers using 8085 microprocessor kit for the following operations. A. B. C. D. Addition Subtraction Multiplication Division

APPARATUS REQUIRED: Apparatus Required S.No 1. 8085 Microprocessor kit 2. Power supply 3. Opcode sheet A. ALGORITHM FOR 16-BIT ADDITION: 1. Start the program 2. Load the first 16-bit data from memory into HL register pair 3. Move the first 16-bit data from HL register pair to DE register pair 4. Load the second 16-bit data from memory into HL register pair 5. Initialize the C register as 00H 6. Move content of L register into accumulator 7. Add the content of E register to content of accumulator 8. Move content of accumulator(result of lower 8-bit addition) into L register 9. Move content of H register into accumulator 10. Add the content of D register to content of accumulator with carry 11. If carry zero means go to step 13 12. Increment C register 13. Move content of accumulator(result of higher 8-bit addition) into H register 14. Store the output from HL register pair to memory 15. Move content of C register into accumulator 16. Store the carry result in another memory location 17. Stop the program Quantity 1 1

FLOW CHART FOR 16-BIT ADDITION:


Start

Get first data in HL register pair

Save the content in DE register pair

Get second data in HL register

Add the content of DE reg pair with HL pair

Store the sum (A register) in memory

Stop

PROGRAM FOR 16 BIT ADDITION:

ADDRESS 8500 8503 8504 8507 8509 850A 850B 850C 850D 850E 8511 8512 8513 8516 8517 851A

LABEL

MNEMONICS OPCODE LHLD 9000 XCHG LHLD 9002 MVI C,00 MOV A,L ADD E MOV L,A MOV A,M ADC D JNC STEP1 INR C MOV H,A SHLD 9100 MOV A,C STA 9102 HLT

OPERAND

COMMENTS

STEP1

B.

ALGORITHM FOR 16-BIT SUBTRACTION:

1. Start the program 2. Load the first 16-bit data from memory into HL register pair 3. Move the first 16-bit data from HL register pair to DE register pair 4. Load the second 16-bit data from memory into HL register pair 5. Initialize the C register as 00H 6. Move content of L register into accumulator 7. Subtract the content of E register from content of accumulator 8. Move content of accumulator(result of lower 8-bit subtraction) into L register 9. Move content of H register into accumulator 10. Subtract the content of D register from content of accumulator with borrow 11. If carry zero means go to step 13 12. Increment C register 13. Move content of accumulator(result of higher 8-bit subtract) into H register 14. Store the output from HL register pair to memory 15. Move content of C register into accumulator 16. Store the carry result in another memory location 17. Stop the program

FLOW CHART FOR 16-BIT SUBTRACTION:


Start

Get the lower byte of first number

Get the lower byte of second number

Subtract lower byte of second number


from lower byte of first number

Get the higher byte of first number

Get the higher byte of second number

Subtract higher byte of second number and borrow from previous subtraction

Store the result

Stop

PROGRAM FOR 16 BIT SUBTRACTION:

ADDRESS 8500 8503 8504 8507 8509 850A 850B 850C 850D 850E 8511 8512 8513 8516 8517 851A

LABEL

MNEMONICS LHLD 9000 XCHG LHLD 9002 MVI C,00 MOV A,L SUB E MOV L,A MOV A,M SBB D JNC STEP1 INR C MOV H,A SHLD 9100 MOV A,C STA 9102 HLT

OPCODE

OPERAND

COMMENTS

STEP1

C. ALGORITHM FOR 16- BIT MULTIPLICATION: 1. Start the program. 2. Move the content of accumulator to the B register. 3. Load the HL register into the accumulator. 4. Exchange the content of accumulator to the C register. 5. Load the HL register to the next accumulator. 6. Load the register pair immediately to the H register. 7. Multiply the register with SP. 8. Increment B register. 9. Move the HL register to memory. 10. Compare the OR register pair with E. 11. Store the HL register to memory. 12. Move the content of the memory to register B. 13. Move the content of all memory. 14. Stop the program.

FLOW CHART16 BIT MULTIPLICATION:


Start

Get the lower byte of first number

Get the lower byte of second number

Subtract lower byte of second number from lower byte of first number

Get the higher byte of first number

Get the higher byte of second number

Subtract higher byte of second number and borrow from previous subtraction

Store the result

Stop

PROGRAM FOR 16 BIT MULTIPLICATION:

MEMORY 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B 411C 411D 411E

LABEL

MNEMONICS OPCODE LXI D,0000

COMMENTS

LXI SP,FFFF

LXI B,2222

LXI H,0000

L2

DAD SP JNC L1

L1

INX D DCX B MOV A,C ORA B JNZ L1

SHLD 4500

XCHG SHLD 4502

HLT

ALGORITHM FOR 16 BIT DIVISION: 1. Start the program. 2. Initialize BC to store quotient. 3. Load the dividend. 4. Transfer the content to the register pair DE. 5. Load the divisor. 6. Move the content of H to accumulator. 7. If dividend is less than the divisor then store the result. 8. Store quotient in 16 bit address. 9. Stop the program.

FLOW CHART16 BIT DIVISION:


Start St Start

Get the divisor in A reg, move to B reg and get the dividend in A reg

Clear C register for Quotient

Compare B register and A register

Yes If cy= No

Subtract the content of B register from a register

Store the reminder (A register) in memory

Increment the Quotient (C register)

Move the content of C register to A register and store it in memory

Stop

PROGRAM FOR 16 BIT DIVISION:

MEMORY 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B 411C 411D 411E

LABEL START

MNEMONICS OPCODE LXI H, 4500H

COMMENTS

LXI B, 4502H

LXI D, 4504H

L1

MOV A, L SUB C MOV L, A MOV A, H SBB B MOV H, A JC L2

INX D JMP L1

L2

DAD B SHLD 4506

XCHG SHLD 4508H

HLT

Exp no: 6 Date :

PROGRAMMING FOR ARITHMETIC OPERATIONS USING 8086 ARITHMETIC OPERATION AIM: To perform arithmetic operations like addition, subtraction, multiplication and division using 8086. 1. 2. 3. 4. ADDITION: SUBTRACTION. MULTIPLICATION. DIVISION

APPARATUS REQUIRED: S.No 1. 2. 3. Apparatus Required 8085 Microprocessor kit Power supply Opcode sheet Quantity 1 1

A. ALGORITHM FOR 16 BIT ADDITIONS; 1. Start the program. 2. Load the first data in AX register. 3. Load the second data in BX register. 4. Clear CL register. 5. Add the two data and get sum in AX register. 6. Store sum in memory. 7. Check for carry. 8. Increment CL register. 9. Stores carry in memory. 10. Stop.

FLOWCHART:
Start

Load the first data in AX register

Load the second data in Bx register

Clear CL register

YES
Is CF= 1 Increment CL reg NO

Store carry in memory

Stop

PROGRAM FOR 16 BIT ADDITIONS IN 8086: Memory Address 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C 100D 100E Hex. Code C7 C0 34 12 C7 C3 78 56 01 D8 89 06 02 11 F4 Mnemonic Instruction Label START Opcode MOV Operand AX ,#1234 Load the data in AX reg Comments

MOV

BX,#5678

Load the data in BX reg

ADD MOV

AX,BX [1200],AX

Add two data and get sum in AX reg Move the sum value to memory

STOP

HLT

Halt the process

B. ALGORITHM FOR 16 BIT SUBTRACTIONS: 1. 2. 3. 4. 5. 6. 7. 8. 9. Start the program. Load the minuend in AX register. Get the subtrahend in BX register. Clear CL register to account for sign. Subtract the content of BX from AX. Check for carry. If cy=1 go to next step. Increment CL register. Store the sign bit in memory. Stop.

FLOWCHART:
Start

Get minuend in AX register

Get subtrahend in BX register

Clear CL register

YES
Is CF= 1 Increment CL reg NO Complement AX register

Store difference in memory

Add 01 to AX

Store sign bit

Stop

PROGRAM FOR 16 BIT SUBTRACTIONS IN 8086: Memory Address 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C 100D 100E Hex. Code C7 C0 34 12 C7 C3 78 56 01 D8 89 06 02 11 F4 Mnemonic Instruction Label START Opcode MOV Operand AX ,#1234 Load the data in AX reg Comments

MOV

BX,#5678

Load the data in BX reg

ADD MOV

AX,BX [1200],AX

Add two data and get sum in AX reg Move the sum value to memory

STOP

HLT

Halt the process

C. ALGORITHM FOR 32 BIT MULTIPLICATIONS: 1. Load address of data in BX register 2. Clear CX register to account for carry 3. Get D1LW in AX & D2 LW in BP 4. Multiply MX&BP to get product1 in AX&BX 5. Save P1UW in SI register 6. Get D1UW in AX register 7. Multiply AX&BP to get product2 in AX&DX 8. Check for array 9. Increment CX 10. Save P2UW in DI register 11. Multiply AX&BP 12. Add P3LW to SI register 13. Add CX & P3LW 14. Clear CX register 15. Check for carry 16. Increment CX register 17. Save third & fourth word of product in memory 18. Stop

FLOWCHART:
Start

Load the address of data in BX register

Get D1 LW in AX register

Get D2 LW in BP

Save P1LW in SI

Get P1UW in AX reg Add D2 LW to SI

Multiply AX & BP

Save AX

Is CF

Increment CX

Save P2 in DI Get D2UW in BP

Multiply AX & BX

Add P3LW to SI

Is CF=1

Increment CX

Add CX & P3UW

Clear CX

Save SI as second word

A Get D1UW in AX Multiply AX & BP to get Product 4 in AX & DX Add DI & AX to get third product Add CX previous carry to get fourth product of final product

Save the data

Stop

PROGRAM FOR 32 BIT MULTIPLICATION IN 8086 Memory Address 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C 100D 100E 100F 1010 1011 1012 Hex.code C7 C0 04 00 C7 C3 05 00 F7 E3 89 06 02 11 89 16 04 11 F4 Mnemonic Instruction Label Opcode START MOV AX,#0004H Comments Move the data in reg AX

MOV BX,#0005H

Move the data in reg BX

MUL BX MOV [1102],AX

Multiply AX and BX Load the data from AX reg to address

MOV [1104],BX

Load the data from BX reg to address

STOP

HLT

Halt the process

D. ALGORITHM FOR DIVISION OF 32 BIT DATA BY 16 BIT DATA 1. 2. 3. 4. 5. 6. 7. Load the address of data in SI register. Get lower word of dividend in AX register. Get upper word of dividend in DX register. Get divisor in BX register. Perform division to get quotient in AX and divider in DX. Save quotient and remainder. Stop.

FLOWCHART
Start

Get lower word of dividend in AX register

Get upper word of dividend in DX register

Divide AX and DX with BX

Save quotient in memory Save remainder in memory

Stop

PROGRAM FOR DIVISION OF 32 BIT BY 16 BIT DATA : Memory Address 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C 100D 100E 100F 1010 1011 1012 Hex.code C7 C0 04 00 C7 C3 05 00 F7 E3 89 06 02 11 89 16 04 11 F4 STOP HLT Halt the process MOV [1104],BX Load the data from BX reg to address MOV [1102],AX Load the data from AX reg to address MUL BX Multiply AX and BX MOV BX,#0005H Move the data in reg BX Mnemonic Instruction Label START Instruction MOV AX,#0004H Move the data in reg AX Comments

Exp no: 7 Date :

PROGRAM WITH 8086 CONTROL INSTRUCTIONS AIM: To write an assembly language program for the below given instructions using 8086 microprocessor kit. A. Maximum/Minimum B. Code conversion APPRATUS REQUIRED: S.NO 1. 2. NAME OF ITEMS 8086-Microprocessor kit Power supply QUANTITY 1

A. ALGORITHM FOR MINIMUM NUMBERS IN AN ARRAY: 1. Start 2. Load starting address of array in SI register 3. Load number of byte in array in CL register 4. Increment array pointer 5. Get first byte of array in AL register 6. Decrement byte count 7. Increment array pointer 8. Get next byte in BL register 9. Compare AL and BL 10. Checks carry flag 11. Move BL and AL 12. Check zero flag 13. Save smallest data 14. Stop

FLOWCHART:
Start

Load address of array in SI register

Load address of result in DI register

Set CL as byte count

Increment array pointer

Get first byte of array in AL register

Decrement byte count


C Increment array pointer

Get byte in BL register

Compare al and BL register

YES
Is cf=0

NO A

A
Move BL and AL

B
Decrement CL

NO

IS YES Store AL in memory

Stop

PROGRAM FOR SEARCHING OF MINIMUM NUMBER IN AN ARRAY Memory Address 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C 100D 100E 100F 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 101A 101B 101C Hex. Code BE 11 00 BF 12 00 8A 0C 46 84 04 FE C9 46 8A 1C 3A C3 72 02 8A C3 FE C9 75 F3 88 05 F4 HLT MOV [DI],A JNC AGAIN if count is not zero repeat search store smallest data in memory AHEAD DEC CL decrement count MOV AL,BL JC AHEAD if cy=1 then AL is less than BL CMP AL,BL AGAIN INC MOV SI BL,[SI] makes SI to point to next data get next data in BL register DEC CL INC MOV SI AL,[SI] increment address pointer MOV CL,[SI] MOV DI,1200 set DI register as pointer for result Mnemonic Instruction Label Opcode Operand MOV SI,1100 Comments set SI register as pointer

B. ALGORITHM FOR MAXIMUM NUMBER IN AN ARRAY 1. Start 2. Load the starting address of array in SI register 3. Load the address of result in DI register 4. Load number of bytes in the array in CL register 5. Increment array pointer 6. Get first byte of array in AL register 7. Get next byte of array in BL register 8. Checks carry flag 9. Move BL and AL 10. Decrement byte count 11. Check zero flag 12. Store largest data 13. Stop

FLOW CHART:
Start

Set SI register as array pointer

Set DI register as result pointer

Set CL as byte count

B
Increment array pointer

Decrement byte count

Get the first byte of array in AL register

Decrement the byte count

Get the next byte of array in BL

Compare AL AND BL register

YES is cf=0

C
NO

MOVE BL AD AL

C
DECREMENT BYTE COUNT NO

IS YES STORE AL IN MEMORY

STOP

PROGRAM FOR SEARCHING OF MAXIMUM NUMBER IN AN ARRAY Memory Address 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C 100D 100E 100F 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 101A 101B 101C Hex. Code BE 11 00 BF 12 00 8A 0C 46 84 04 FE C9 46 8A 1C 3A C3 72 02 8A C3 FE C9 75 F3 88 05 F4 HLT MOV [DI],AL JNC AGAIN if count is not zero repeat search store largest data in memory AHEAD DEC CL decrement count MOV AL,BL JNC AHEAD if cy=1 then BL as current largest CMP AL,BL AGAIN INC MOV SI BL,[SI] makes SI to point to next data get next data in BL register DEC CL INC MOV SI AL,[SI] MOV CL,[SI] set CL as count for element increment address pointer MOV DI,1200 set DI register as pointer for result Mnemonic Instruction Label START Opcode Operand MOV SI,1100 Comments set SI register as pointer

Exp no:8

STRING MANIPULATION

AIM: To write and execute a program to perform the string manipulation multibyte addition using 8086 microprocessor. APPARATUS REQUIRED:

S. NO 1. 2. ALGORITHM: 1. 2. 3. 4. 5. 6. 7. 8. 9.

Apparatus required 8086 microprocessor kit Power supply

Quantity 1 1

XOR the BX register with AX register. XOR the BX register with BX register. Move the data 05 to CL register. Move the content of 1200 to SI register. Move the content of SI register to BL register. Add the content of BX register with AX register and the result is stored in AX register. Execute the loop1 instruction. Move the AX register to SI register. Stop the program.

FLOW CHART:

START XOR the content of BX register with AX register

XOR the content of BX register with BX register

Move the 05 value to CL

Move the content of 1200 to SI register

Move the content of SI to BL register

Increment the SI value

YES

LOOP

NO
A

Move the content of AX to (SI)

STOP

PROGRAM: ADDRESS 1000 OPCODE 31,CD LABEL INSTRUCTION XOR OPERAND AX,BX COMMENTS XOR the content of AX register with BX register XOR the content of BX register with BX register Move the data 05 to CL register Move the content of 1200 to SI register Move the content of SI register to BL register Add the content of BX register with AX register Increment SI register Go to loop 1 Move the content of AX register to SI register Stop the program

1002 1004 1007 100B 100D

31,0B C6,C1,05 C7,C6,00,12 8A,1C 01,08 LOOP 1

XOR MOV MOV MOV ADD

BX,BX CL,05 SI,1200 BL,[SI] AX,BX

100F 1010 1012 1014

46 F2,F9 89,04 F4

INC LOOP MOV HLT

SI LOOP 1 [SI],AX

Exp no:9 AIM:

EVEN OR ODD

To write and execute an assembly language for finding whether the given number is even or odd. APPARATUS REQUIRED: S.NO 1 2 ALGORITHM: 1. Start the program. 2. Clear the CX register. 3. Clear the D register. 4. Move the content 06 to CL register. 5. Move the content 1300 to SI register. 6. Move the SI value to AL register. 7. Shift AL register by one. 8. Jump if carry to LI. 9. Increments BL register value. 10. Jump to loop 2. 11. Increment DL value. 12. Increment SI value. 13. Go to loop 3. 14. Move the content from DL to SI and BL to SI. 15. Increment SI value. 16. Stop the program. APPARATUS REQUIRED 8086 Microprocessor kit Power supply QUANTITY 1 1

FLOW CHART:

Start

Clear the CX register

Clear the DL register

Clear the BL register

Move the data 06 to CL register Move the content of 1300 to SI register B Move the SI value to AL register A

Jump carry

Increment the BL register

YES

Jump if carry

NO

Increment the DL value

Increment the SI value


YES

Loop
NO

Move the content of DL to (SI)

Increment the SI value

Move the content of BL to (SI)

Stop

PROGRAM:

ADDRESS 1000 1004 1007 100A 100E 1010 1012 1014 1016 1019 101B 101C 101E 1020 1021 1023

OPCODE LABEL INSTRUCTION C7,C1,00,00 MOV C6,C2,00 MOV C6,C3,00 MOV C6,C1,06 C7,C6,06,13 L3 D2,EB 72,05 FE,C3 E9,1E,10 FF,C2 46 E2,FO 88,14 46 88,1C F4 MOV MOV SHR JC INC JMP INC INC LOOP MOV INC MOV HLT

OPERAND CX,00 DL,00 CL,06 SI,1300 AL,[SI] AL 101C BL 101B DL SI 100E [SI],DL SI [SI],DL

L1 L2

COMMENT Clear the CX register Clear the DL register Move the data 06 to CL register Move the content of 1300 to SI register Move the content of SI to AL register Shift AL register by one Jump if carry to L2 Increment BL register by one Jump to L1 Increment DL by one Increment SI value Go to loop 3 Move the content DL to SI Increment SI value Move the content DI to SI Stop the program

Exp no: 10 Date : PROGRAMMING FOR 8 BIT ARITHMETIC OPERATION USING 8051 AIM: To write an assembly language program for 8- bit addition, subtraction, multiplication and division using 8051. APPARATUS REQUIRED: 1. 8051 microcontroller 2. Power supply
ALGORITHM FOR 8 BIT ADDITIONS: 1. 2. 3. 4. 5. 6. Start the program Get the 1st operand in accumulator Add 2nd operand with 1st operand in accumulator Move data from accumulator to data pointer Store the result in memory Stop

FLOW CHART:

Start Get the 1st operand in A


Add the immediate data with content of A register

Store the result in memory

Stop

PROGRAM FOR 8-BIT ADDITION OF 8051 Memory Address 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 Mnemonic Instruction Label Opcode MOV ADD MOV Operand A,#34 A,#62 DPTR,#4500

Hex. Code 74 34 24 62 90 45 00 F0 80 FE

Comments Get 1st operand in A register Add operand in A register

MOV SJMP

X@DPTR,A 4108

Store the result in memory

ALGORITHM 8 BIT SUBTRACTION IN 8051: 1. 2. 3. 4. 5. 6. Start the program Get the 1st operand in accumulator Subtract 2nd operand from 1st operand in accumulator Move data from accumulator to data pointer Store the result in memory Stop

FLOWCHART:

Start Get the 1st operand in A register Subtract 2nd operand from A register Store the result in memory

Stop

PROGRAM FOR 8-BIT SUBTRACTION OF 8051:


Memory Address 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 Hex. Code 74 12 94 68 90 45 00 F0 80 FE MOV SJMP X@DPTR,A 4108 Store the result in memory MOV DPTR,#4500 SUBB A,#08 Subtract 2nd operand from accumulator Move to data pointer Mnemonic Instruction Label Opcode MOV Operand A,#12 Comments Get 1st operand in A register

ALGORITHM FOR MULTIPLICATION: 1. 2. 3. 4. 5. Start the program Get the two numbers Multiply two numbers Store the result Stop the program

FLOW CHART FOR MULTIPLICATION

Start

Get the data

Multiply two numbers

Store the result Stop

PROGRAM FOR MULTIPLICATION: ADDRESS 4100 4102 4105 4106 4109 410A 410B 410D 410E LABEL START MNEMONICS MOV A,#04 MOV B,# 02 MUL A,B MOV DPTR,#4500 MOVX @ DPTR,A INC DPTR MOV A ,B MOV X,@DPTR,A SJMP HERE OPCODE 74,04 75, F0,02 A4 90,45,00 F0 A3 E5,F0 F0 80, FE

HERE

ALGORITHM FOR DIVISION: 1. 2. 3. 4. 5. Start the program Get the two numbers Divide two numbers Store the result Stop the program

FLOW CHART FOR DIVISION:

Start

Get two inputs

Divide

two numbers
Store the results

Stop

PROGRAM FOR DIVISION: ADDRESS 4100 4102 4105 4106 4109 410A 410B 410D 410E LABEL START MNEMONICS MOV A,#08 MOV B,# 02 DIV AB MOV DPTR,#4500 MOV X@ DPTR,A INC DPTR MOV A ,B MOV X,@DPTR,A SJMP HERE OPCODE 74,08 75,F0,02 84 90,45, 00 F0 A3 E5,F0 F0 80,FE

HERE

Exp no :11 Date: 1S AND 2S COMPLEMENT USING 8051 AIM: To write an assembly language program for 1s and 2s complement using 8051.

ALGORITHM:

1. 2. 3. 4. 5. 6. 7. 8. 9.

Start the program. Move the value to a register. Compliment the value of a register. The result is stored in the address of 4500. Move the content of a to DPTR. Increment the a value. Increment the DPTR value. Move the content of a to DPTR. Jump to the next process.

PROGRAM:

ADDRESS 4100 4101 4102

OPCODE

LABEL

MNEMONICS MOVE

OPERAND A, #DPTR

COMMENTS Move the content of DPTR value to A Compliment the value of A Move the value from 4200 to DPTR

CPL

4103 4104 4105 4106

MOV

DPTR, #4200

MOV X

@DPTR, A

Move the A value to DPTR Increment the A Value Increment the DPTR Value Move the content of A value to DPTR Short jump

4107 4108

INC INC

A DPTR

4109

MOV X

@DPTR, A

410A 410B

SJMP

410A

FLOW CHART:

Start

Get divide in A

Get divide in B

Divide by B

Store result in memory

Stop

PROGRAM:

ADDRESS 4100 4101 4102 4103 4104 4105

OPCODE

LABEL

MNEMONICS MOV

OPERAND A, #08

COMMENTS Move the content to A register Move the content to B register

MOV

B, #02

DIV

A,B

Divide the content of B from A

Exp no: 12 Date : INTERFACING AND PROGRAMMING OF STEPPER MOTOR CONTROL USING 8085

AIM: To interface stepper motor with 8085. APPARATUS REQUIRED: 1. 8085 microcontroller kit 2. Stepper motor control kit 3. Power supply ALGORITHM: 1. 2. 3. 4. 5. 6. 7. Start the program Set count for four stepping sequence. Set control word. Set output data for a sequence. Wait for one millisecond. Decrement count value. Stop.

FLOW CHART:
Start

Initialize ports

Set count for 4 stepping sequence

Output data for a sequence

Wait for 1 millisecond

No
Is Count=0?

Yes

PROGRAM FOR INTERFACING OF STEPPER MOTOR WITH 8085: Memory Address 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B 411C 411D 411E Hex. Code 21 1A 41 06 04 7E D3 C0 11 03 03 00 1B 7B B2 C2 0B 41 23 05 C2 05 41 C3 00 41 DB 09 05 06 0A Mnemonic Instruction Label Opcode Operand START LXI H,LOOK UP Comments

MVI REPT MOV OUT LXI

B,04 A,M 0C0H D,0303H

Out data Move immediate data

DELAY

NOP DCX MOV ORA JNZ

D A,E D DELAY

Decrement DE pair

If non zero jump to delay

INX DCR JNZ

H B REPT

Increment HL pair Decrement B If it is non zero jump to Rept

JMP

START

Jump to start

LOOK UP To rotate in forward direction

Exp no:13 Date:

INTERFACING 8253 TIMER WITH 8085

AIM: To interface 8253 interface board to 8085 p and verify the operation of 8253 in six different modes. APPARATUS REQUIRED: 8085 p kit, 8253 interface board, DC regulated power supply, VXT parallel bus, CRO. FLOW CHART: Start

Move immediately 00 to accumulator Out the (A) port

Move immediately CC to A register

Out the A port value Move immediately 90 to A Out the A port value Move immediately 88 to A register

Out the A value to DAT register

Out the A port value

Stop

PROGRAM:

Address 4100 4102 4104 4106 4108 410A 410C

Opcodes 3E 36 D3 CE 3E 0A D3 C8 3E 00 D3 C8 76

Label START:

Mnemonic MVI OUT MVI OUT MVI OUT HLT

Operands A,36 CE A,0A C8 A,00 C8

Comments Channel 0 in mode 3 Send Mode control word LSB of count Write count to register MSB of count Write count to register Stop the program

Exp no:14 Date : PROGRAMMING FOR INTERFACE EXPERIMENTS AIM: To study the value of analog to digital conversion and digital to analog conversion. A. ADC INTERFACING WITH 8085 B. DAC INTERFACING WITH 8085 APPARATUS REQUIRED: 1. 8085 microprocessor kit 2. ADC, DAC interface card A. ALGORITHM FOR ADC INTERFACE: 1. 2. 3. 4. 5. 6. Start the program Initialize the count value Move the data immediately to the accumulator Store the data in specified address Display the data with LED glowing ON/OFF Stop the program

FLOWCHART:
Start

Initialize the value

Set the mode for count

Transfer the data to output address

Check it with LED

Display

Stop

PROGRAM FOR ADC INTERFACE: Memory address 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 Label Mnemonics Hexade Comments Op code Operand cimal code MVI A,10 3E Move the data immediately to the accumulator 10 OUT E0 D3 Display to port E0 MVI A,18 3E Move the data immediately to the accumulator 18 OUT E0 D3 Display to port E0 MVI A,01 3E Move the data 00 immediately to the accumulator 01 OUT D0 D3 Display to port D0 XRA A AF Clear the accumulator content XRA A AF Clear the accumulator content XRA A AF Clear the accumulator content MVI A,00 3E Move the data 00 immediately to the accumulator 00 OUT D0 D3 Display to port D0 HLT 76 Halt the program

Start

B. ALGORITHM FOR DAC INTERFACE: A. SQUARE WAVE GENERATOR: B. SAW TOOTH WAVEFORM C. TRIANGULAR WAVEFORM

A. ALGORITHM FOR SQUARE WAVE GENERATOR: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. Start the program Clear the accumulator Load minimum value to the accumulator Display data in output port address Call subroutine SQR Delay program SQR Assign first count to C register Assign second count to B register Decrement the second count If count is zero, decrement the count else go to step 9 If carry is zero go to step 8 Return to main program

Start Clear the accumulator content

Load the data in output port

Display the output port

Call the subroutine

Load the maximum value in acc

Display the data in the output port Call the subroutine

Delay the SQR

Assign I count to C reg Assign II count to B reg

Decrement II count

Count= 0 Decrement I count

Count= 0 Stop

PROGRAM FOR SQUARE WAVE GENERATOR:


Memory address 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B 411C 411D 411E Label Mnemonics Op code Operand MVI A,00 Hexade cimal code 3E 00 D3 C0 CD 12 41 3E FF D3 C0 CD 12 41 C3 01 41 0E 03 06 FF 05 C2 16 41 0D C2 14 41 76 Comments

Move the data immediately to the accumulator Display to port Call the subroutine

OUT CALL

C0 SQR

MVI

A,FF

Move the data immediately to the accumulator Display to port Call the subroutine

OUT CALL

C0 SQR

JMP

LOOP1

Jump to specified location

MVI

C,03

Move the data immediately to the accumulator Move the data immediately to the accumulator Decrement the B register Jump to specified location if no zero exists

MVI

B,FF

DCR JNZ

B LOOP4

DCR JNZ

C LOOP3

Decrement the B register Jump to specified location if no zero exists

RET

Return to main program

B. ALGORITHM FOR SAW TOOTH WAVEFORM:


1. 2. 3. 4. 5. Start the program Load initial data as accumulator Display the first data in output port address Decrement the content of accumulator If the data is zero jump to loop1

FLOWCHART:
Start

Load the initial value in the acc

Display the data in accumulator to output port address

Increment the content of accumulator

Check the data is valid

Stop

PROGRAM FOR SAW TOOTH WAVEFORM:


Memory address 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 405A Label Mnemonics Op code Operand MVI A,00 Hexade cimal code 3E 00 D3 C0 3C C2 52 40 C3 50 40 Comments

LOOP1

Move the data immediately to the accumulator Write the data from A to port address Increment the Accumulator Jump to specified location if no zero occurs

LOOP2

OUT

C0

INR JNZ

A LOOP2

JMP

LOOP1

Jump to specified location

C. ALGORITHM FOR TRIANGULAR WAVEFORM:


1. Start the program 2. Load the initial data in the accumulator 3. Write the data from the accumulator to the output port address 4. Increment the content of accumulator 5. If zero flag is reset, jump to loop1 6. Move the data FF to accumulator 7. Write the data from the accumulator to the output port address 8. Decrement the content of accumulator 9. Jump to loop3 if no zero exist

FLOW CHART:

Start

Load the initial data to accumulator

Display 1st content in output port

No
If Z

Yes Initialize the 2nd content of accumulator

Display accumulator content in o/p port

Decrement 1st value

No
If ZF

Yes

PROGRAM FOR TRIANGULAR WAVEFORM:


Memory address 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 406A 406B 406C 406D 406E 406F 4070 4071 4072 Label Mnemonics Op code Operand MVI A,00 Hexade cimal code 3E 00 D3 C0 3C C2 62 40 3E FF D3 C0 3D C2 6A 40 C3 50 40 Comments

LOOP3

Move the data immediately to the accumulator Write the data from A to port address Increment the Accumulator Jump to specified location if no zero occurs

LOOP1

OUT

C0

INR JNZ

A LOOP1

MVI

A,FF

Move the data immediately to the accumulator Write the data from A to port address Decrement the Accumulator Jump to specified location if no zero occurs

LOOP2

OUT

C0

DCR JNZ

A LOOP2

JMP

LOOP1

Jump to specified location

Exp no:15 Date : PROGRAMMING FOR INTERFACE EXPERIMENTS AIM: To control the traffic light using 8085 microprocessor and interface of 8279

APPARATUS REQUIRED: 8085 trainer kit, 8279 interface board, DC power supply.

B. ALGORITHM FOR INTERFACING 8279 WITH 8085 TO DISPLAY THE CHARACTER C 1. 2. 3. 4. 5. 6. 7. Start the program Get mode and display set By immediate address mode get value in A-register Count value in display Write content in display RAM Out the character Stop

FLOW CHART:
Start

Move the value in A register

Clear the display

Get the values of display

Out the counter value

Display the character

Stop

PROGRAM FOR INTERFACING OF 8279 WITH 8085: Memory Address 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B 411C Hex. Code 3E 00 D3 C2 3E CC D3 C2 3E CC D3 C2 3E 6C D3 C0 3E FF D3 C0 D3 C0 D3 C0 D3 C0 D3 C0 76 Mnemonic Instruction Label Opcode Operand MVI A,00 OUT MVI OUT MVI OUT MVI OUT MVI OUT OUT OUT OUT OUT HLT C2 A,CC C2 A,90 C2 A,6C C0 A,FF C0 C0 C0 C0 C0 Out the content Display C Write display RAM Comments Mode & Display set Out control word C2 Clear display RAM

Exp no:16 Date: Interfacing 8251 with 8085

AIM: To interface 8251 with 8085

APPARATUS REQUIRED:

8085 p kit, 8251 interface board, DC regulated power supply, VXT parallel bus.

B (1).ALGORITHM FOR INTERFACING OF 8251 WITH 8085: 1. Start the program. 2. At transmitter side move the data to accumulator. 3. Out the data to port CE. 4. Move the data from port to A. 5. AND 04 with the content of accumulator. 6. If it is non zero jump on to LOP. 7. REST 1. 8. For reception move the data to accumulator. 9. out data to various port. 10. Input data from port. 11. If it is non zero jump on to LOP1. 12. AND data with accumulator. 13. Store the result in 4150. 14. RESET 1.

FLOW CHART:
Start

In transmitter side move the data to accumulator Out the data to port CE

Store result

Stop
Out data to various Port

Move the data from port to A

AND 04 with the content of Yes

If
N RESET 1

In receiver side move data to accumulator

Out data to port

AND 02 with A Yes If N

PROGRAM FOR INTERFACING OF 8251 WITH 8085 TRANSMITTER PROGRAM: Mnemonic Instruction Memory Hex. Address Code Label Opcode Operand 4100 3E START MVI A,36 4101 36 4102 D3 OUT OCE H 4103 CE 4104 3E MVI A,0A 4105 0A 4106 D3 OUT OC8 H 4107 C8 4108 3E MVI A,00 4109 00 410A D3 OUT OC8 H 410B C8 410C 3E MVI A,4E 410D 4E 410E D3 OUT OC2 H 410F C2 4110 3E MVI A,37 4111 37 4112 D3 OUT OC2 H 4113 C2 4114 DB 4115 C2 LOP IN OC2 H 4116 E6 ANI 04 4117 04 4118 CA JZ LOP 4119 14 411A 41 411B 3E MVI A,41 H 411C 41 411D D3 OUT OC0 H 411E CO 411F CF RST 1

Comments Move data to accumulator. Out the data

Out the data to port Clear accumulator

Out the data to port

Cut the data from port And immediate data 04 with A Jump on zero to LOP

Reset

RECEIVER PROGRAM: Mnemonic Instruction Memory Hex. Address Code Label Opcode Operand 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 420A 420B 420C 420D 420E 420F 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 421A 421B 3E 36 D3 CE 3E 0A D3 C8 3E 00 D3 C8 3E 4E D3 C2 3E 37 D3 C2 DB C2 E6 02 CA 14 42 DB IN OC0 H JZ LOP1 LOP1: IN ANI OC2 H 02 OUT OC2 H MVI A,37 OUT OC2 H MVI A,4E OUT OC8 H MVI A,00 OUT C8 H MVI A,0A OUT OCE H MVI A,36

Comments Move 36 to accumulator

AND 02 with accumulator Jump on zero to LOP 1

Memory Address 421C 421D 421E 421F 4220

Hex. Code CO 32 50 41 CF

Mnemonic Instruction Label Opcode Operand STA 4150

Comments

Store in 4150

RST

Exp no:17 Date:


INTERFACING 8255 WITH 8085 AIM: To interface programmable peripheral interface 8255 with 8085 and study its characteristics in mode 0, mode 1 and BSR mode. APPARATUS REQUIRED: 8085 p kit, 8255 interface board, DC regulated power supply, VXT parallel bus. I/O MODES:

MODE 0 SIMPLE I/O MODE:

PROGRAM:

ADDRESS OPCODES 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B

LABEL START:

MNEMONICS MVI

OPERAND A,90

COMMENTS Initialize port A as input and port B as output Send Mode Control Word Read from port A Display the data in port B Store the data read from port A in 4200

OUT IN OUT STA

C6 C0 C2 4200

STOP:

HLT

Stop the program

MODE1 STROBED I/O MODE

MAIN PROGRAM: ADDRESS OPCODES 4100 4101 4102 4103 4104 4105 4106 4107

LABEL START:

MNEMONICS MVI

OPERAND A,B4

COMMENTS Initialize port A as input port in mode 1 Send Mode Control Word Set the PC4 bit for INTE A Display the data in port B

OUT MVI OUT

C6 A,09 C6

EI 4108 4109 410A 410B MVI SIM EI HLT Stop the program A,08 Enable RST5.5

ISR(Interrupt Service Routine) ADDRESS OPCODES LABEL MNEMONICS OPERAND 4200 START: IN C0 4201 4202 4203 4204 4205 HLT STA 4500

COMMENTS

Sub program: ADDRESS OPCODES 450E 450F 4560

LABEL

MNEMONICS JMP

OPERAND 4200

COMMENTTS Go to 4200

BSR MODE(Bit Set Reset mode) PROGRAM: ADDRESS OPCODES 4100 4101 4102 4103 4104 4105 4106 4107 4108

LABEL START:

MNEMONICS OPERAND MVI A,01 OUT MVI OUT C6 A,07 C6

COMMENTS Set PC0 Send Mode Control Word Set PC3 Send Mode Control Word Stop the program

STOP:

HLT

S-ar putea să vă placă și