Post on 18-Nov-2014
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 Opcode Label Mnemonics Comments4101 MVI C,00 Move immediate 00 to C register41024103 LDA 4500 Load accumulator with the content of 4104 Address 450041054106 MOV B,A Move the content of B-register to
Accumulator4107 LDA 4501 Load accumulator with the content of 4108 Address 45014109410A MOV D,A Move the content of D-register to
Accumulator410B XRA A X-OR the content of accumulator410C L2 ADD B Add the content of B register to
accumulator content410D JNC L1 Jump if no carry to label location L1
410E410F4110 INR C Increment C register4111 L1 DCR D Decrenent D register4112 JNZ L2 Jump on no zero to label location L2411341144115 STA 4503 Store accumulator content to address
4503411641174118 MOV A,C Move the content of C-register to
Accumulator4119 STA 4504 Store accumulator content to address
4504411A411B411C HLT Halt the program execution
ALGORITHM:
8-BIT DIVISION:
1. Initialize a register for quotient.2. Get the two input data (divisor and dividend) from memory locations.3. Compare divisor and dividend.4. Check for carry, if set goto step 8, else to next step. 5. Subtract divisor from dividend.6. Increment the quotient register.7. Go to step 3.8. Store the remainder and quotient in memory locations.9. Stop program execution.
PROGRAM:
Address Opcode Label Mnemonics Comments4101 MVI C,00 Move immediate 00 to C register41024103 LDA 4500 Load accumulator with the content of 4104 Address 450041054106 MOV B,A Move the content of B-register to
Accumulator4107 LDA 4501 Load accumulator with the content of 4108 Address 4501
4109410A L2 CMP B Compare B register content to
accumulator content410B JC L1 Jump on carry to label location L2410C410D410E SUB B Subtract the content of B register from
accumulator content410F INR C Increment C register4110 JMP L2 Jump to label location L2411141124113 L1 STA 4503 Store accumulator content to address
4503411441154116 MOV A,C Move the content of C-register to
Accumulator4117 STA 4504 Store accumulator content to address
450441184119411A HLT Halt the program execution
PROCEDURE:
1. Key in the opcodes. 2. Give the input data at specified memory locations.3. Execute the program.4. Check the results at specified output locations.
OBSERVATION :
8-bit Multiplication Address DataInput 4500 08
4501 03Output 4503 18 (Product LSB)
4504 00 (Carry MSB)
8-bit Division Address DataInput 4500 08
4501 03Output 4503 02 (Remainder)
4504 02 (Quotient)
Result:
Thus the assembly language programs for 8-bit multiplication and division are written, executed and the results are verified.
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. Clear a register for carry.2. Get the LSBs of two 16-bit data.3. Add the LSBs and Store the result in memory location.4. Get the MSBs of two 16-bit data.5. Add the MSBs with carry of LSBs.6. Check for carry. If carry =1, goto next step, else goto step 7.7. Increment the carry register8. Store the result (MSBs sum) and carry in memory locations.9. Stop program execution.
PROGRAM:
Address Opcode Label Mnemonics Comments4101 MVI C,00 Move immediate 00 to C register41024103 LHLD 4500 Load HL registers with the contents of
Address 4500, 4501410441054106 MOV B,L Move the content of L-register to B
register4107 LHLD 4502 Load HL registers with the contents of
Address 4502, 450341084109
410A MOV A,L Move the content of L-register to Accumulator.
410B ADD B Add B register content to accumulator content
410C STA 4600 Store accumulator content to address 4600
410D410E410F MOV A,H Move the content of H-register to
Accumulator4110 ADC D Add with carry, D register content to
accumulator content4111 JNC L1 Jump on no carry to label location L2411241134114 INR C Increment C register4115 L1 STA 4601 Store accumulator content to address
4601411641174118 MOV A,C Move the content of C-register to
Accumulator4119 STA 4602 Store accumulator content to address
4602411A411B411C HLT Halt the program execution
16-BIT SUBTRACTION:
ALGORITHM:
1. Clear a register for carry.2. Get the LSBs of two 16-bit data.3. Subtract the LSBs and Store the result in memory location.4. Get the MSBs of two 16-bit data.5. Subtract the MSBs with borrow.6. Check for carry (borrow). If carry =1, goto next step, else goto step 7.7. Increment the carry register8. Store the result (MSBs difference) and carry in memory locations.9. Stop program execution.
PROGRAM:
Address Opcode Label Mnemonics Comments4101 MVI C,00 Move immediate 00 to C register41024103 LHLD 4500 Load HL registers with the contents of4104 Address 4500, 450141054106 MOV B,L Move the content of L-register to B
register4107 MOV D,H Move the content of H-register to D
register.4108 LHLD 4502 Load HL registers with the contents of4109 Address 4502, 4503410A410B MOV A,L Move the content of L-register to
Accumulator410C SUB B Subtract B register content from
accumulator content410D STA 4600 Store accumulator content to address
4600410E410F4110 MOV A,H Move the content of H-register to
Accumulator4111 SBB D Subtract with borrow,D register content
from accumulator content4112 JNC L1 Jump on no carry to label location L2411341144115 INR C Increment C register4116 L1 STA 4601 Store accumulator content to address
4601411741184119 MOV A,C Move the content of C-register to
Accumulator411A STA 4602 Store accumulator content to address
4602411B411C411D HLT Halt the program execution
PROCEDURE:
1. Key in the opcodes. 2. Give the input data at specified memory locations.3. Execute the program.4. Check the results at specified output locations.
OBSERVATION :
16-bit Addition Address DataInput 4500 08
4501 034502 044503 07
Output 4600 0C ( LSB Sum)4601 0A ( MSB Sum)4602 00 ( Carry)
16-bit Subtraction Address DataInput 4500 08
4501 0A4502 094504 0B
Output 4600 014601 014602 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 Opcode Label Mnemonics Comments4101 LXI B,0000 Load immediate 0000 to BC register pair410241034104 LHLD 4500 Load HL registers with the contents of
Address 4500, 4501410541064107 SPHL Move the content of HL-registers to
stack pointer register.4108 LHLD 4502 Load HL registers with the contents of
Address 4502, 45034109410A410B XCHG Exchange the contents of HL and DE
register pairs410C LXI H,0000 Load immediate 0000 to HL register pair410D410E410F L2 DAD SP Add the content of stack pointer register
to HL register pair4110 JNC L1 Jump on no carry to label location L1411141124113 INX B Increment BC register pair4114 L1 DCX D Decrement DE register pair4115 MOV A,E Move the content of E-register to
Accumulator4116 ORA D Logigally OR the content of D register to
accumulator4117 JNZ L2 Jump on no zero to label location L241184119411A SHLD 4600 Store the contents of HL registers to
address 4600,4601411B411C411D MOV L,C Move the content of C-register to L
register411E MOV H,B Move the content of B-register to H
register411F SHLD 4602 Store the contents of HL registers to
address 4602,4603412041214122 HLT Halt the program execution
16-BIT DIVISION:
ALGORITHM:
1. Initialize a register pair for quotient.2. Get the two 16-bit data (in HL pair and in a register pair).3. Save HL pair’s content to stack.4. Subtract the LSBs and Store the result in L-register.5. Subtract the MSBs with borrow.6. Check for carry (borrow). If carry =1, goto step 9, else goto next step.7. Increment the register pair for quotient.8. 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 Opcode Label Mnemonics Comments4101 LXI D,0000 Load immediate 0000 to DE register pair410241034104 LHLD 4500 Load HL registers with the contents of
Address 4500, 4501410541064107 LXI B, 16-
bit dataLoad immediate 16-bit data to BC register pair
41084109410A SPHL Move the content of HL-registers to
stack pointer register.410B MOV A.L410C SUB C Load immediate 0000 to HL register pair410D MOV L,A Move the content of L-register to B
register410E MOV A,H410F L2 SBB B Add the content of stack pointer register
to HL register pair4110 JC L1 Jump on no carry to label location L1411141124113 INX D Increment BC register pair4114 L1 MOV H,A Decrement DE register pair4115 JMP L2 Move the content of E-register to
Accumulator4116 Logigally OR the content of D register to
accumulator4117 Jump on no zero to label location L24118 LXI H,00004119411A Store the contents of HL registers to
address 4600,4601411B DAD SP411C SHLD 4600 Store the contents of HL registers to
address 4600,4601411D
411E Move the content of B-register to H register
411F XCHG Exchange the contents of HL and DE register pairs
4120 SHLD 4602 Store the contents of HL registers to address 4602,4603
412141224123 HLT Halt the program execution
PROCEDURE:
1. Key in the opcodes. 2. Give the input data at specified memory locations.3. Execute the program.4. Check the results at specified output locations.
OBSERVATION :
16-bit Multiplication Address DataInput 4500 24(LSB1)
4501 5A(MSB1)4502 C2(LSB2)4503 47(MSB2)
Output 4600 48(LSB Product)4601 4B(LSB Product)4602 44(MSB Product)4603 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. Initialize a register for carry.2. Get the two input data.(One data in accumulator and another in register)3. Add the two data.4. Restore the result in BCD.5. Check for carry. If carry =1, goto next step, else goto step 7.6. Increment the carry register.7. Store the result and carry in memory locations.8. Stop program execution.
PROGRAM:
Address Opcode Label Mnemonics Comments4101 MVI C,00 Move immediate 00 to C register41024103 LDA 4500 Load Accumulator with the content of
Address 4500410441054106 MOV B,A Move the content of accumulator to B
register4107 LDA 4501 Load Accumulator with the content of
Address 450141084109410A ADD B Add B register content to accumulator
content410B DAA Decimal Adjust Accumulator410C JNC L1 Jump on no carry to label location L1410D410E410F INR C Increment C register4110 L1 STA 4601 Store accumulator content to address
4601411141124113 MOV A,C Move the content of C-register to
Accumulator4114 STA 4602 Store accumulator content to address
4602411541164117 HLT 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 Opcode Label Mnemonics Comments4101 LDA 4500 Load Accumulator with the content of
Address 4500410241034104 MOV B,A Move the content of accumulator to B
register4105 MVI A,99 Move immediate 00 to A register41064107 SUB B Subtract the content of B-register from
Accumulator content4108 INR A Increment A register content4109 MOV B,A Move the content of accumulator to B
registe410A LDA 4501 Load Accumulator with the content of
Address 4501410B410C410D ADD B Add B register content to accumulator
content410E DAA Decimal Adjust Accumulator410F STA 4601 Store accumulator content to address
4601411041114112 HLT 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 Opcode Label Mnemonics Comments4101 LDA 4500 Load accumulator with the content of
Address 4500410241034104 MOV E,A Move the content of Accumulator to E
register4105 ANI F0 AND immediate F0, with the content of
accumulator41064107 RLC Rotate accumulator left to carry4108 RLC Rotate accumulator left to carry4109 RLC Rotate accumulator left to carry410A RLC Rotate accumulator left to carry410B MOV B,A Move the content of Accumulator to B
register410C XRA A X-OR the content of accumulator410D MVI C,0A Move immediate 0A to C register410E410F L1 ADD B Add the content of B register to
accumulator content4110 DCR C Decrement C register4111 JNZ L1 Jump on no zero to label location L1411241134114 MOV B,A Move the content of Accumulator to B
register4115 MOV A,E Move the content of E register to
Accumulator 4116 ANI 0F AND immediate 0F, with the content of
accumulator4117 ADD B Add the content of B register to
accumulator content4118 STA 4501 Store accumulator content to address
45014119411A411B HLT Halt the program execution
PROCEDURE:
1. Key in the opcodes. 2. Give the input data at specified memory locations.3. Execute the program.4. Check the results at specified output locations.
OBSERVATION :
BCD Addition Address DataInput 4500 24
4501 55Output 4601 79
4602 00
BCD Subtraction Address DataInput 4500 24
4501 55Output 4601 31
Bit Manipulation(BCD to Binary Conversion)
Address Data
Input 4500 45(BCD)Output 4501 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. Compare the nibble in Accumulator with 0A(Hex).2. If Carry=1, goto step 4, else goto next step.3. Add 07(Hex) to the nibble in Accumulator.4. Add 30(Hex) to the nibble in Accumulator.5. Return to main program.
PROGRAM:
Address Opcode Label Mnemonics Comments4101 LDA 4200 Load accumulator with the content of
Address 4200410241034104 MOV B,A Move the content of Accumulator to B
register
4105 ANI 0F AND immediate 0F, with the content of accumulator
4106CALL 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
ANI F0 AND immediate F0, with the content of accumulator
4107 RLC Rotate accumulator left to carry4108 RLC Rotate accumulator left to carry4109 RLC Rotate accumulator left to carry410A RLC Rotate accumulator left to carry410B CALL Code Call the Subroutine labeled “Code”410C410D410E STA 4202 Store accumulator content to address
4202410F41104111 HLT Halt the program execution
41124113 Code: CPI 0A Compare immediate 0a with the content
of accumulator41144115 JC L1 Jump on carry to label location L14116 ADI 07 ADD immediate 07, with the content of
accumulator41174118 L1 ADI 30 ADD immediate 30, with the content of
accumulator4119411A RET Return to main program
OBSERVATION :
Binary(HEX) to ASCII Address DataInput 4200 E4(HEX)Output 4201 34(ASCII Code for 4)
4202 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. What is the difference between RLC and RAL?2. What are machine control instructions?3. How many machine cycles are required for STA 4500?4. What is T-State?5. 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. Form the look up table.2. Move the control word to accumulator and out it through control register.3. Get the letters one by one from memory and out it.4. Check whether all letters are displayed. If not, display next character.5. Stop of program.
PROGRAM:
ADDRESS OPCODE LABEL MNEMONICS COMMENTS4500 21 LXI H, 4600 Load immediate HL register
pair with 46004501 004502 464503 3E MVI A, 10 Move immediate 10 to
accumulator4504 904505 D3 OUT 01 Out it through CR4506 014507 7E L1 MOV A,M Move memory content to
accumulator4508 D3 OUT 00 Out it through 8279 port4509 00450A 23 INX H Increment HL register pair450B 7D MOV A,L Move the content of L
register to accumulator450C FE CPI 06 Compare immediate with 06450D 06450E C2 JNZ L1 Jump on no zero to label
location L1450F 074510 814511 76 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 BLOCKBinary(HEX) to ASCII Address DataInput 4200 02
4201 084202 09
Output 4500 024501 084502 09
ADDING AN ARRAYAddress Data
Input 4200 024201 084202 03
Output 4500 OD
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 DataInput 4200 02
4201 084202 034203 09
Output 4500 024501 034502 084503 09
SEARCHING:TO SEARCH 02 Address Data
Input 4200 024201 084202 034203 09
Output 4500 02
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, Non-
buffered 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 ; Transfer data
OUT PA
HLT
11. REVERSING AN ARRAY OF DATA
AIM:
To write an assembly language program to perform reversingan array of elements.
APPRATUS REQUIRED:8085 KIT
ALGORITHM:
1. Load the HL register pair with some data in 42002. Load the BC register pair in 43003. 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 MNEMONICS OPERAND COMMENTS
4100 21,00,42 LXI H,4200 Load the HL pair with some data in 4200
4103 D1,00,43 LXI B,4300 Load the BC pair in 4300
4106 16,05 MVI D,05 Move immediately the data 05H to D register
4108 79 MOV A,C Move the C-register value to the A
4109 82 ADD D Add the content of D with Accumulator
410A 4F MOV C,A Move the accumulator content to the C-register
410B 0B DCX B Decrement the content of the BE-register pair
410C 7E Loop MOV A,M Move the content of M
to the accumulator410D 02 STAX B Store the content of the
BC-register pair410E 23 INX H Increment the content
of the HL-register pair410F 0B DCX B Decrement the content
of the BC-register pair.4110 15 DCR D Decrement the content
of D-register.4111 62,0C,41 JNC Loop If no carry jump to the
loop.4114 76 HLT 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 DATA FIELD
INPUT FIELD 4200 01H4201 02H4202 03H4203 04H4204 05H
OUTPUT FIELD 4300 05H4301 04H4302 03H4303 02H4304 01H
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 4200H2. Move the contents of the accumulator to B Register3. Load the accumulator by data in the address 4201H4. Clear C Register5. Add the content of the accumulator to B Register content6. If no carry jump to loop7. Increment C Register8. Shift the content of the accumulator to the location 42039. Move the contents of the C Register to accumulator.10. Shift the content of the accumulator to the location 420411. Halt the current Program
ADDRESS HEXCODE
LABELMNEMONICS OPERAND COMMENTS
4100 3A,00,42 LDA 4200 Load the accumulator with data in 4200
4103 47 MOV B,A Move the contents of the accumulator to B Register
4104 3A,01,42 LDA 4201 Load the accumulator with data in 4201
4107 0E,00 MVI C,00 Clear C Register
4109 80 ADD B Add the content of the B Register to accumulator.
410A D2,0E,41 JNC loopIf no carry jump to loop
410D 0C INR C Increment C Register
410E 32,02,42
Loop
STA 4202 Shift the content of the accumulator to the location 4202
4111 79 MOV A,C Move the contents of the C Register to the accumulator.
4112 32,03,42 STA 4203 Shift the content of the accumulator to the location 4203
4115 76 HLT Stop the current ProgramPROGRAM:
PROCEDURE:1. Key in opcode from the address specified2. 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 ADDRESS FIELD DATA FIELD
INPUT FIELD 4200 04H4201 09H
OUTPUT FIELD
4202 0DH4203 00H
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 RotationValue
Clockwise RotationValueStep A1 A2 B1 B2 A1 A2 B1 B2
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 register2. Move the count value to CL register.3. Move the contents of destination index to AL.4. Output the loaded values between delay5. Decrement the contents of DX register6. If no zero jump to the L17. Increment destination index register.8. Loop to loop1.9. Move the delay value to BX register.10. Decrement the contents of BX register11. If no zero jump to L2.12. Jump to beginning address13. 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
START
STOP
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
CALL DELAY
IFDI>Cou
nt
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 0 1 1 0 1 1 0
D7 D0
D7:D6 - Counter 0
D5:D4 - LSB first MSB next
D3:D1 - Square wave rate generator
D0 - Binary Code
Divisor Value:
Divisor Value = Clock frequency of Counter0
Desired Frequency
ALGORITHM:1. Load the Control word2. Output the value through the port3. Load the divisor value to count the specific frequency (LSB value)4. Output the value through the port5. Load the divisor value to count the specific frequency (MSB value)6. Output the value through the port7. 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 8085Operating frequency : 3.102 MHZUser 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 counter3. 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 accumulator10. OR the E-register11. If no jump to loop, decrement C register.12. If no jump to loop, pop the B-register.13. Return.
PROGRAM:
ADDRESS HEXCODE LABEL MNEMONICS OPERAND COMMENTS
4100 21,00,45 Start LXI H,4500 Load the HL-register pair
4103 OE,OC MVI C,OC Move data OC to C register4105 7E MOV A,M Move HL contents to
accumulator4106 D3,OF OUT CNT Count the value4108 23 INX H Increment HL pair4109 7E Loop1 MOV A,M Move the content of M to
A-register410A D3,OC OUT A Out A port410C 23 INX H Increment HL register pair410D 7E MOV A,M Move the content of M to
accumulator410E D3,OD OUT B Out B port4110 CD,1B,41 CALL Delay Call the Delay4113 23 INX H Increment HL pair4114 OD DCR C Decrement the C register4115 C2,09,41 JNZ LOOP1 If no zero jump to loop4118 C3,00,41 JMP Start Jump to Start411B C5 Delay PUSH B Push B register411C OE,05 MVI C,05 Move data 05 to C register411E 11,FF,FF Loop3 LXI D,FF,FF Load the DE-pair4121 1B Loop2 DCX D Decrement D-register4122 7A MOV A,D Move D-register to
accumulator4123 B3 ORA E OR the E-register4124 C2,21,41 JNZ Loop2 If no zero jump to Loop24127 OD DCR C Decrement C-register4128 C2,1E,41 JNZ Loop3 If no zero jump to Loop3412B C1 POP B Pop the B-register412C C9 RET 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 ADDRESS FIELD DATA FIELDInput field 4500 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 8085Operating Frequency :3.012MHzUser RAM Area :4100-5FFF
ALGORITHM:1. Load the accumulator by data in the address 4200H2. Move the contents of the accumulator to B Register3. Load the accumulator by data in the address 4201H4. Move the contents of the accumulator to C Register5. Clear D Register and Accumulator6. Add the content of the accumulator to B Register content7. Adjust for decimal8. If no carry jump to loop 9. Increment D Register10. Decrement C Register11. Jump on no zero to loop112. Store the content of the accumulator to the desired location 13. Move the contents of the D Register to accumulator14. Store the content of the accumulator to the desired location 15. Halt the current Program
PROGRAM:
ADDRESS HEXCODE
LABELMNEMONICS OPERAND COMMENTS
4100 3A,00,42 LDA 4200 Load the accumulator with data in 4200
4103 47 MOV B,A Move the contents of the accumulator to B Register
4104 3A,01,42 LDA 4201 Load the accumulator with data in 4201
4107 4F MOV C,A Move the contents of the accumulator to C Register
4108 AF XRA A Clear A register4109 16,00 MVI D,00
Clear D register
410B 80Loop1
ADD B Add the contents of B register to A
410C 27 DAA Decimal adjust the contents of accumulator
410D D2,11,41 JNC Loop Jump to given location if there is no carry
4110 14 INR D Increment the D register4111 0D Loop DCR C Decrement the C register4112 C2,0B,41 JNZ Loop1 Jump on no zero to Loop1 4115 32,02,42 STA 4202 Store the content of A to the
location 42024118 7A MOV A,D Move the contents of the to
D Register to accumulator4119 32,03,42 STA 4203 Store the content of A to the
location 4202411C 76 HLT Stop the current Program
PROCEDURE:1. Key in opcode from the address specified2. 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
INPUT FIELD 4200 04H4201 03H
OUTPUT FIELD
4202 12H4203 00H