Microprocessor Lab Manual
Microprocessor Lab Manual
AIM
To write programs to perform arithmetic operations using 8085 microprocessor.
APPARATUS REQUIRED
8085 microprocessor kit
+5V Power supply
ALGORITHM
TO ADD TWO 8 BIT DATA WITH CARRY
1) Start
2) One data is loaded in accumulator and content of accumulator is moved to
register B.
3) The second data is loaded in accumulator.
4) Initialize C register with 00H.
5) The content of register B is added with the content of accumulator.
6) A conditional jump instruction is used. If no carry occurs, the result is
stored in any address. If carry occurs, the content of C register is
incremented by 1.
7) Content of C register is moved to accumulator and stored in any address.
8) Stop.
RESULT
Thus the 8-bit arithmetic operations has been performed using 8085
microprocessor.
EX. No:2 16 -BIT ARITHMETIC OPERATIONS
AIM
To write programs to perform 16-bit arithmetic operations using 8085
microprocessor.
APPARATUS REQUIRED
8085 microprocessor kit
+5V Power supply
ALGORITHM
ADDITION
SUBTRACTION
1) Load the dividend in one register and divisor in another register pair
2) Initialize DE register pair for quotient
3) Check whether division is possible. Compare the two data, if there is no
carry subtraction is performed and remaining value is stored in one
register pair
4) If there is a carry, quotient will be zero and remainder will be dividend
5) For each subtraction increment the content of quotient register pait
6) The quotient and remainder are stored in successive memory locations
7) End of the program
801A HLT 76
TO MULTIPLY TWO 16 BIT DATA
RESULT
Thus the 16-bit arithmetic operations has been performed using 8085
microprocessor.
EX.No. 3 SORTING AND SEARCHING OPERATION USING 8085
AIM
To write an assembly language program to sort an array of data in ascending order
and descending order and also to search the smallest and largest data in an array
APPARATUS REQUIRED
8085 microprocessor kit
+5 v power supply
ALGORITHM
ASCENDING ORDER
DESCENDING ORDER
Ascending order
RESULT
Thus ascending, descending, searching of smallest and largest of a given number were
performed using 8085 microprocessor kit.
Ex.No.11 PROGRAMMING USING 8086 MICROPROCESSOR
AIM
To write programs to perform arithmetic operations in 8086.
APPARATUS REQUIRED
8086 microprocessor kit
+5V Power Supply
PROCEDURE
ADDITION/SUBTRACTION
MULTIPLICATION/DIVISION
1) Move the data from memory location to S1 & D1 registers.
2) Load the 16 bit data to AX & BX registers (Multiplier & Multiplicand, Dividend
& Divisor).
3) Multiply or divide the content of BX & AX registers.
4) Clear for carry.
5) Store the product result in AX register.
6) If there is carry store it in DX register.
ASSUME
CS:CODE,
DS:CODE
0000 CODE SEGMENT Initialize code segment
1000 ORG 1000H
1000 MOV AX,0000H B8,0000 Move 0000 to AX
register
1000 MOV CX,0000H B9,0000 Move 0000 to CX reg
1003 MOV SI,1500H B9,1500 Move 1500 to source
index reg
1006 MOV DI,1600H BE,1600 Move 1600 to
destination index reg
1009 MOV AX,[SI] 8B,04 Move [SI] to AX reg
MULTIPLICATION/DIVISION
ADDRESS LABEL MNEMONICS OPCODE COMMENTS
ASSUME
CS:CODE,
DS:CODE
0000 CODE SEGMENT Initialize code segment
2000 ORG 2000H Initialize the starting
address
2000 MOV SI,1500H BE 15 00 Move 1500 to source
index reg
2003 MOVAX,[SI] 8B 04 Move content of SI reg
to Ax reg
2005 INC SI 46 Increment SI reg
2006 INC SI 46 Increment SI reg
2007 MOV BX,[SI] 8B 1C Move content of SI reg
to BX reg
2009 MUL/DIV BX FF E3/F3 Multiply/divide AX reg
by BX reg
200B MOV DI,1600 BF 16 00 Move DI to 1600 reg
200E MOV [DI],AX 89 05 Move the content AX to
DI reg
2010 INC DI 47 Increment DI reg
2011 INC DI 47 Increment DI reg
2012 MOV [DI],DX 89 15 Move the content of DX
reg to DI reg
2014 INT 03H CC Program termination
interrupt
2015 CODE ENDS End of codes
END End of the program
RESULT
Thus the arithmetic operations in 8086 has been performed & executed.
EX.No.12 SORTING AND SEARCHING USING 8086 MICROPROCESSOR
AIM
To write the program to perform sorting and searching operation in 8086
APPARATUS REQUIRED
8086 Microprocessor kit
+5v Power supply
ALGORITHM
ASSUME
CS:CODE,
DS:CODE
0000 CODE SEGMENT Initialize code segment
2000 ORG 2000H Initialize the starting
address
2000 MOV CL,04 B1 04 Move the data 04 to CL
2002 L3 MOV SI,1500 BE 15 00 Move the content in
1500 to SI
2005 MOV CH,04 BE 04 Move the data 04 to CH
2007 L2 MOV AX,[SI] 8B 04 Move SI data to AX
2009 INC SI 46 Increment SI reg
200A INC SI 46 Increment SI reg
200B MOV BX,[SI] 8B 1C Move content of SI to
BX
200D CMP AX,BX 3B C3 Compare AX with BX
200F JC/JNC L1 73 08 Jump on carry or no
carry to L1
2011 MOV [SI],AX 89 04 Move Ax to SI
2013 DEC SI 4E Decrement SI reg
2014 DEC SI 4E Decrement SI reg
2015 MOV [SI],BX 89 1C Move BX reg to SI reg
2017 INC SI 46 Increment SI reg
2018 INC SI 46 Increment SI reg
2019 L1 DEC CH FE CD Decrement CH reg
2021 JNZ L2 75 EA Jump on no zero to L2
201D DEC CL FE C9 Decrement CL reg
201F JNZ L3 75 E1 Jump on no zero to L3
2021 INT 03 CC Termination of the
program
CODE ENDS End of the code segment
END End of the program
ASSUME
CS:CODE,
DS:CODE
0000 CODE SEGMENT Initialize code segment
2000 ORG 2000H Initialize the starting
address
2000 MOV CL,03 B1 03 Move the data 03 to CL
2002 MOV SI,1500 BE 15 00 Move the content in
1500 to SI
2005 MOV DI,1600 BF 16 00 Move the in 1600 to DI
2008 MOV AX,[SI] 8B 04 Move SI data to AX
200A INC SI 46 Increment SI reg
200B INC SI 46 Increment SI reg
200C DEC CL FE C9 Decrement CL reg
200E L2 MOV BX,[SI] 8B 1C Move content of SI to
BX
2010 CMP AX,BX 3B C3 Compare AX with BX
2012 JC/JNC L1 73 02 Jump on carry or no
carry to L1
2014 MOV AX,BX 8B C3 Move BX to AX
2016 L1 INC SI 46 increment SI reg
2017 INC SI 46 increment SI reg
2018 DEC CL FE C9 Decrement CL reg
201A JNZ L2 75 F2 Jump no zero to L2
201C MOV [DI],AX 89 05 Move AX reg to DI
201E INT 03 CC Termination of the
program
CODE ENDS End of the code segment
END End of the program
RESULT
Thus the searching and sorting operations in 8086 has been performed &
executed.
Ex.No.13
APPARATUS REQUIRED
PC, Macro assembler software
ALGORITHM
RESULT
Thus the keyboard control program using BIOS/DOS calls in 8086 has been
performed & executed.
APPARATUS REQUIRED
PC, Macro assembler software
ALGORITHM
RESULT
Thus the program for display a message on the screen and copy a string using
BIOS/DOS calls in 8086 has been performed & executed.
AIM
To write an assembly language program to perform File manipulations
APPARATUS REQUIRED
PC, Macro assembler software
ALGORITHM
FILE CREATION
1) Data segment, Extra segment ,code segment registers are initialized
2) Move the offset address of label msg to the DX register
3) Move the values 0000H to CX and 3CH to AH to create a file in normal
mode using INT 21 DOS CALL
4) If carry flag is zero, the file is created and display the message FILE
CREATED
5) If carry flag is set, the file is not created and display the message FILE IS
NOT CREATED
6) End of the program by using DOS CALL
Thus the program to perform file manipulations in 8086 has been performed &
executed.
AIM
To perform arithmetic operations using 8051 microcontroller
APPARATUS REQUIRED
8051 microcontroller Kit, RS-232 cable, power supply, PC
ALGORITHM
ADDITION
ADDRESS LABEL MNEMONICS OPCODE COMMENTS
80009 CLR C C3 Clear the carry flag
8001 MOV R0,#00 78 00 Move 00 to R0 reg
8003 MOV DPTR,#8300 90 83 00 Move the addr 8300 to
DPTR
8006 MOV R1,#0FF 79 FF Move FF data to R1 reg
8008 MOV A,R1 E9 Move R1 to A reg
8009 MOV R2,#10 7A 10 Move data to R2 reg
800B ADD A,R2 2A Add A with R2
800C JNC L1 50 02 Jump to L1 if no carry
800E INC R0 8 Increment R0 value
800F L1 MOVX @DPTR,A F0 Move A reg content to
the addr
8010 MOV A,R0 B8 Move R0 content to acc
8011 INC DPTR A3 Increment DPTR by
one
8012 MOVX @DPTR,A F0 Move A reg content to
the addr
8013 LJMP 0003 02 00 03 Long jump to the addr
0003
SUBTRACTION
MULTIPLICATION
DIVISION
RESULT
Thus the arithmetic operation in 8051 microcontroller has been performed and
executed.
AIM
To perform code conversions using 8051 microcontroller
APPARATUS REQUIRED
8051 microcontroller Kit, RS-232 cable, power supply, PC
ALGORITHM
APPARATUS REQUIRED
8051 Microcontroller kit,RS-232 Cable, Power supply, PC, CRO, Interfacing card
ALGORITHM
TIMER
INTERRUPT
RESULT
Thus the timer and interrupt operation in 8051 microcontroller has been
performed and executed.