RIT Lab Manual MCMP
RIT Lab Manual MCMP
RIT Lab Manual MCMP
CHENNAI - 600124
LAB MANUAL
Prepared by:
LT P C
0 0 3 2
OBJECTIVES:
LIST OF EXPERIMENTS:
TOTAL: 45 PERIODS
CYCLE 1:
8086 MICROPROCESSOR
CYCLE 2:
CYCLE 3:
INTERFACING (8086&8051)
1. STEPPER MOTOR.
2. PARALLEL COMMUNICATION(8255)
3. DIGITAL TO ANALOG CONVERTOR (DAC).
4. COUNTER DESIGN.
5. KEYBOARD AND DISPLAY.
6. TRAFFIC LIGHT CONTROLLER.
7. DIGITAL CLOCK
8. PRINTER STATUS
9. SERIAL AND PARALLEL INTERFACE
EXECUTION PROCEDURE FOR 8086 (for registers)
i) Writing a alp program into processor:
Switch On Power Supply
Press A 2times
SG 0 press enter
DA starting address
Press enter
N
st
Then display shows @ here you have to write 1 mnemonic
Press enter
N (display displays address opcode mnemonic)
N
Then display shows @ here you have to write 2nd mnemonic
Press enter
N
N
-
-
Then display shows @ up to last mnemonic
Press enter
N
N
! Press
enter EX
press
enter
ii) Execution of program (for registers):
G enter starting address
Press enter
iii) Verify the CONCLUSION (for
registers): press R Press E.
EXECUTION PROCEDURE FOR 8086 (for memory locations)
i) Writing a alp program into processor:
Switch On Power Supply
Press A
A
SG 0
Press enter
DA starting address
Press enter
N
st
Then display shows @ here you have to write 1 mnemonic
Press enter
N(display displays address opcode mnemonic)
N
Then display shows @ here you have to write 2nd mnemonic
Press enter
N
N
-
-
-
-
Then display shows @ up to last mnemonic
Press enter
N
N
! Press
enter EX
press
enter E
(exam
byte)
st
Here you have to type SI address, give 1 data, 2nd data, -----,
nth data, Press enter
ii) Execution of program (for memory locations):
G enter starting address
Press enter
iii) Verify the CONCLUSION (for memory locations):
E
Then give DI address press, then display
st
shows the CONCLUSION of 1 8 bit data
nd
For 2 8 bit data again press, -------, nth data
Introduction to MASM /TASM
NOTE : The Assembler only finds syntax errors : It will not tell you whether program does
what it is supposed to do. To determine whether your program works, you have to run the
program and test it.
Next step is to process the object file with linker.
C:\MASM\BIN>LINK filename. obj
Run File [Filename1.exe] : “filename1.exe”
List file [nul.map]: NUL
Libraries [.lib]: library name
Definitions File [nul.def]:
Creation of Library: Refer Modular Programming Section
A Linker is a program used to join several object files into one layer object file.
NOTE: On IBM PC – type Computers, You must run the LINK program on your .OBJ file even
if it contains only one assembly module.
The linker produces a link file with the .EXE extension (an execution file)
Next Run C:\MASM\BIN> filename
8086
MICROPROCESSOR
16-BITADDITION & SUBTRACTION
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to perform16-bit addition
and subtraction using 8086 microprocessor.
COMPONENTS REQUIRED:
ALGORITHM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
1000 MOV BX,2000 BB
Initialize the memory
1001 00
pointer
1002 20
1003 MOV AX,[BX] 8B Move the first data from
1004 07 memory to AX
1005 INC BX 43 Increment memory
1006 INC BX 43 Increment memory
1007 MOV CX,[BX] 8B Move the second data
1008 0F from memory to CX
1009 MOV DL,00 B2
Clear DL register
100A 00
100B ADD AX,CX 01
Add AX with CX
100C C8
100D JNB 1011(XXX) 73
Jump if no carry occurs
100E 02
10OF INC DL FE
Increment carry
1010 C2
1011 XXX INC BX 43 Increment memory
1012 INC BX 43 Increment memory
1013 MOV [BX],AX 89 Store sum in memory
1014 07 location
1015 INC BX 43 Increment memory
1016 INC BX 43 Increment memory
1017 MOV [BX],DL 88 Store carry in memory
1018 17 location
1019 HLT F4 Stop the program
16 BIT ADDITION:
By using MASM:
Assume cs: code
Code segment
Start: MOV AX, 4343
MOV BX, 1111
ADD AX, BX
INT 3
Code ends
End start
WITHOUT CARRY
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
2000 2004
2001 2005
2002 2006
2003
WITH CARRY
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
2000 2004
2001 2005
2002 2006
2003
FLOW CHART:
I6-BIT SUBTRACTION
PROGRAM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
1000 MOV BX,2000 BB
Initialize the memory
1001 00
pointer
1002 20
1003 MOV AX,[BX] 8B Move the first data from
1004 07 memory to AX
1005 INC BX 43 Increment memory
1006 INC BX 43 Increment memory
1007 MOV DX,[BX] 8B Move the second data
1008 0F from memory to DX
1009 MOV CL,00 BL
Clear CL register
100A 00
100B SUB AX,DX 29
Subtract AX with DX
100C D0
100D JNB 1011(XXX) 73
Jump if no borrow occurs
100E 02
10OF INC CL FE
Increment carry
1010 C1
1011 XXX INC BX 43 Increment memory
1012 INC BX 43 Increment memory
1013 MOV [BX],AX 89 Store difference in
1014 07 memory
1015 INC BX 43 Increment memory
1016 INC BX 43 Increment memory
1017 MOV [BX],CL 89
Store borrow in memory
1018 0F
1019 HLT F4 Stop the program
16-BIT SUBTRACTION
By using MASM:
Assume cs: code
Code segment
Start: MOV AX, 4343
MOV BX, 1111
SUB AX, BX
INT 3
Code ends
End start
2000 2004
2001 2005
2002 2006
2003
WITH BORROW
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
2000 2004
2001 2005
2002 2006
2003
VIVA QUESTIONS
iii) Explain the logic behind the programs for arithmetic operations.
iv) What is the max size of memory that can be connected with 8086 microprocessor?
v) What are the general purposes registers available in 8086?
vi) What are the functional units in 8086 and state the purpose of each unit.
vii) Mention the index registers of 8086 and their use.
viii) What is the use of IP & base pointer register?
ix) What are the 8086 instructions used for BCD arithmetic?
CONCLUSION:
16-BIT MULTIPLICATION & DIVISION
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to perform16-bit
multiplication and division using 8086 microprocessor.
COMPONENTS REQUIRED:
ALGORITHM:
16-BIT MULTIPLICATION
PROGARM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
1000 MOV BX,2000 BB
Initialize the memory
1001 00
pointer
1002 20
1003 MOV AX,[BX] 8B Move the first data
1004 07 from memory to AX
1005 INC BX 43 Increment memory
1006 INC BX 43 Increment memory
1007 MOV CX,[BX] 8B Move the second data
1008 0F from memory to CX
1009 MOV DX,00 BL
Clear DX register
100A 00
100B MUL CX 29
Multiply AX with CX
100C D0
100D INC BX 73 Increment memory
100E INC BX 02 Increment memory
10OF MOV [BX],AX FE Store product in
1010 C1 memory
1011 INC BX 43 Increment memory
1012 INC BX 43 Increment memory
1013 MOV [BX],DX 89
Store carry in memory
1014 07
1015 HLT 43 Stop the program
16-BIT MULTIPLICATION
By using MASM:
Assume cs: code
Code segment
Start: MOV AX, 4343
MOV BX, 1111
MUL BX
INT 3
Code ends
End start
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
2000 2004
2001 2005
2002 2006
2003 2007
WITH CARRY
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
2000 2004
2001 2005
2002 2006
2003 2007
FLOW CHART:
16-BIT DIVISION
PROGRAM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
1000 MOV BX,2000 BB
Initialize the memory
1001 00
pointer
1002 20
1003 MOV AX,[BX] 8B Move the first data from
1004 07 memory to AX
1005 INC BX 43 Increment memory
1006 INC BX 43 Increment memory
1007 MOV CX,[BX] 8B Move the second data
1008 0F from memory to CX
1009 MOV DX,00 BL
Clear DX register
100A 00
100B DIV CX 29
Divide AX with CX
100C D0
100D INC BX 73 Increment memory
100E INC BX 02 Increment memory
10OF MOV [BX],AX FE
Store quotient in memory
1010 C1
1011 INC BX 43 Increment memory
1012 INC BX 43 Increment memory
1013 MOV [BX],DX 89 Store remainder in
1014 07 memory
1015 HLT 43 Stop the program
16-BIT DIVISION
By using MASM:
Assume cs: code
Code segment
Start: MOV AX,4343
MOV BX,1111
MUL BX
INT 3
Code ends
End start
2000 2004
2001 2005
2002 2006
2003 2007
WITH REMAINDER
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
2000 2004
2001 2005
2002 2006
2003 2007
CONCLUSION:
ASCENDING AND DESCENDING ORDER
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to perform ascending and
descending order using 8086 microprocessor.
COMPONENTS REQUIRED:
ALGORITHM:
STEP 4: Compare the numbers and exchange if necessary so that the two numbers
are in ascending order/descending order.
STEP 6: Get the third number from the array and repeat step no:4 until CX is 0.
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
1000 MOV DX,0005 BA
Move count value into DX
1001 05
register
1002 00
1003 DEC DX 4A Decrement count value
1004 ZZZ MOV CX,DX 89
Move DX to CX
1005 D1
1006 MOV SI,3000 BE
1007 00 Initialize the memory
1008 30
1009 YYY MOV AX,[SI] 8B Move first data into
100A 04 accumulator
100B CMP AX,[SI+02] 3B Compare values of
100C 44 Accumulator and next value
100D 02 in the memory
100E JB 1015(XXX) 72
Jump if borrow occurs
10OF 05
1010 XCHG [SI+02],AX 87
Exchange the values of AX
1011 44
and memory
1012 02
1013 XCHG {SI],AX 87 Exchange the values of AX
1014 04 and memory
1015 XXX ADD SI,0002 83
Increment the memory
1016 C6
location address
1017 02
1018 LOOP 1009(YYY) E2 Unconditional jump to
1019 EF 1009
101A DEC DX 4A Decrement the count
101B JNE 1004(ZZZ) 75
Jump if not zero(or) equal
101C E7
101D HLT F4 Stop the program
ASCENDING ORDER
By using MASM:
ASSUME CS: CODE
CODE SEGMENT
START: MOV AX, 0000H
MOV CH, 0004H
DEC CH
UP1 : MOV CL, CH
MOV SI, 2000
UP: MOV AL, [SI]
INC SI
CMP AL, [SI]
JC DOWN
XCHG AL, [SI]
DEC SI
MOV [SI], AL
INC SI
DOWN: DEC CL
JNZ UP
DEC CH
JNZ UP1
INT 3
CODE ENDS
END START
SAMPLE INPUT AND OUTPUT
ASCENDING ORDER
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
3000 3000
3001 3001
3002 3002
3003 3003
3004 3004
3005 3005
3006 3006
3007 3007
3008 3008
3009 3009
FLOW CHART: DESCENDING:
PROGRAM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
1000 MOV DX,0005 BA
Move count value into DX
1001 05
register
1002 00
1003 DEC DX 4A Decrement count value
1004 ZZZ MOV CX,DX 89
Move DX to CX
1005 D1
1006 MOV SI,3000 BE
1007 00 Initialize the memory
1008 30
1009 YYY MOV AX,[SI] 8B Move first data into
100A 04 accumulator
100B CMP AX,[SI+02] 3B Compare values of
100C 44 Accumulator and next value in
100D 02 the memory
100E JNB 1015(XXX) 73
Jump if not borrow occurs
10OF 05
1010 XCHG [SI+02],AX 87
Exchange the values of AX and
1011 44
memory
1012 02
1013 XCHG {SI],AX 87 Exchange the values of AX and
1014 04 memory
1015 XXX ADD SI,0002 83
Increment the memory location
1016 C6
address
1017 02
1018 LOOP 1009(YYY) E2
Unconditional jump to 1009
1019 EF
101A DEC DX 4A Decrement the count
101B JNE 1004(ZZZ) 75
Jump if not zero(or) equal
101C E7
101D HLT F4 Stop the program
DESCENDING ORDER
By using MASM:
ASSUME CS: CODE
CODE SEGMENT
START: MOV AX, 0000H
MOV CH, 0004H
DEC CH
UP1 : MOV CL, CH
MOV SI, 2000
UP: MOV AL, [SI]
INC SI
CMP AL, [SI]
JNC DOWN
XCHG AL, [SI]
DEC SI
MOV [SI], AL
INC SI
DOWN: DEC CL
JNZ UP
DEC CH
JNZ UP1
INT 3
CODE ENDS
END START
SAMPLE INPUT AND OUTPUT
DESCENDING ORDER
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
3000 3000
3001 3001
3002 3002
3003 3003
3004 3004
3005 3005
3006 3006
3007 3007
3008 3008
3009 3009
CONCLUSION:
LARGEST AND SMALLEST NUMBER
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to perform largest and
smallest number among N numbers using 8086 microprocessor.
COMPONENTS REQUIRED:
ALGORITHM:
STEP 6: Get the third number from the array and repeat step no:4 until CX is 0.
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
1000 MOV AX,6000 B8,00,60 Move data segment value
1003 MOV DS,AX 8E,D8 Move AX to DS
1005 CLD FC Clear directional flag
1006 MOV CX,0005 B9
1007 05 Give count value to CX
1008 00
1009 MOV SI,4000 BE
100A 00 Initialize the input address
100B 40
100C MOV DI,5000 BF
100D 00 Initialize the output address
100E 50
100F MOV AX,[SI] 8B
Get the first data
1010 04
1011 YYY CMP AX,[SI+02] 3B
1012 44 Compare the two data
1013 02
1014 JNB 1019(XXX) 73
Jump if no borrow
1015 03
1016 XCHG [SI+02],AX 87
1017 44 Exchange the values
1018 02
1019 XXX INC SI 46 Increment memory
101A INC SI 46 Increment memory
101B LOOP 1011(YYY) E2
Unconditional jump to 1011
101C F4
101D MOV [DI],AX 89,05 Store the CONCLUSION
101F HLT F4 Stop the program
SAMPLE INPUT AND OUTPUT
LARGEST NUMBER
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
4000 5000
4001 5001
4002
4003
4004
4005
4006
4007
4008
4009
FLOW CHART: SMALLEST
PROGRAM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
1000 MOV AX,6000 B8,00,60 Move data segment value
1003 MOV DS,AX 8E,D8 Move AX to DS
1005 CLD FC Clear directional flag
1006 MOV CX,0005 B9
1007 05 Give count value to CX
1008 00
1009 MOV SI,4000 BE
100A 00 Initialize the input address
100B 40
100C MOV DI,5000 BF
100D 00 Initialize the output address
100E 50
100F MOV AX,[SI] 8B
Get the first data
1010 04
1011 YYY CMP AX,[SI+02] 3B
1012 44 Compare the two data‟s
1013 02
1014 JB 1019(XXX) 72 Jump if no borrow go to
1015 03 1019
1016 XCHG [SI+02],AX 87
1017 44 Exchange the values
1018 02
1019 XXX INC SI 46 Increment memory
101A INC SI 46 Increment memory
101B LOOP 1011(YYY) E2
Unconditional jump to 1011
101C F4
101D MOV [DI],AX 89,05 Store the CONCLUSION
101F HLT F4 Stop the program
SMALLEST NUMBER
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
4000 5000
4001 5001
4002
4003
4004
4005
4006
4007
4008
4009
CONCLUSION:
COPY OPERATION
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to perform copy operation
using 8086 microprocessor.
COMPONENTS REQUIRED:
ALGORITHM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
1000 MOV AX,5000 B8
1001 00 Get the segment values
1002 50
1003 MOV DS,AX 8E Move AX values into data
1004 D8 segment
1005 MOV DX,0005 B9
Move count value in to DX
1006 05
register
1007 00
1008 MOV SI,2000 BE
Move source address into
1009 00
SI register
100A 20
100B MOV DI,3000 BE
Move destination address
100C 00
into DI register
100D 30
100E KKK MOV BL,[SI] 8A
Move SI to BL register
10OF 1C
1010 MOV [DI],BL 88
Move BL to DI
1011 1D
1012 INC SI 46 Increment SI
1013 INC DI 47 Increment DI
1014 DEC DX 4A Decrease the count value
1015 LOOP 100E(KKK) E2 Unconditional jump to
1016 F7 100E
1017 HLT F4 Stop the program
SAMPLE INPUT AND OUTPUT
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
2000 3000
2001 3001
2002 3002
2003 3003
2004 3004
CONCLUSION:
STRING MANIPULATION
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) for string manipulation
using 8086 microprocessor.
COMPONENTS REQUIRED:
ALGORITHM:
STEP 2: Set the SI to point the source array and DI at destination location.
STEP 4: Direction flag is cleared so that SI & DI will auto increment after each
loop.
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
1000 MOV SI,1100
Move the source address to
1001
SI
1002
1003 MOV DI,1200
Move the destination
1004
address to DI register
1005
1006 MOV CX,00FF
Set the length of array
1007
element
1008
1009 CLD Clear the direction flag
100A XXX MOVSB Move the string byte
100B LOOP 100A(XXX)
Unconditional loop
100C
100D HLT Stop the program
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
1100 1200
TO TO
11FF 12FF
CONCLUSION:
CONVERSION OF BCD TO BINARY AND VICEVERSA
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to convert BCD to BINARY
and vice versa using 8086 microprocessor.
COMPONENTS REQUIRED:
ALGORITHM:
BCD TO BINARY
STEP 1: Start the program.
STEP 2: Get the input data.
STEP 3: performing AND operation between input and F0.
STEP 4: Rotate right AL with CL.
STEP 5: performing multiplication operation between DH and 0A.
STEP 6: Store the CONCLUSION in memory.
STEP 7: Stop the program.
BINARY TO BCD
STEP 1: Start the program.
STEP 2: Get the input data.
STEP 3: compare and then subtract the value 100 from the input.
STEP 4: compare and then subtract the value 10 from the input.
STEP 5: performing rotate left operation with AL by 04.
STEP 6: Store the CONCLUSION in memory.
STEP 7: Stop the program.
FLOW CHART:
PROGRAM:
BCD TO BINARY
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
3000 MOV BX,1100 BB
3001 00 Initialize the memory pointer
3002 11
3003 MOV AL,[BX] 8A Move the data from memory
3004 07 to AL register
3005 MOV DL,AL 88
Move the data from AL to DL
3006 C2
3007 AND DL,0F 80 Logical AND between DL
3008 0F and data 0F
3009 AND AL,F0 24 Logical AND between AL
300A F0 and data F0
300B MOV CL,04 B1
Move data 04 to CL
300C 04
300D ROR AL,CL D2
Rotate right AL with CL
300E C8
300F MOV DH,0A B6
Move data 0A to DH
3010 0A
3011 MUL DH,0A F6
Multiply DH with data 0A
3012 E6
3013 ADD AL,DL 00 Add the content of AL with
3014 D0 DL
3015 MOV [BX+1],AL 88
Store the CONCLUSION in
3016 47
memory location
3017 01
3018 HLT F4 Stop the program
1100 1101
BINARY TO BCD
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
1000 MOV CL,00 B1
Move the data 00 to CL
1001 00
1002 MOV BL,CL 88 Move the content of CL to
1003 CB BL
1004 MOV SI,2000 BE
Initialize the memory
1005 00
pointer
1006 20
1007 MOV AL,[SI] 8A Get the input data from
1008 04 memory location
1009 RRR CMP AL,64 3C Compare AL with
100A 64 immediate data 64
100B JB 1013(KKK) 72
Jump if borrow
100C 06
100D SUB AL,64 2C Subtract AL with
100E 64 immediate data 64
100F INC AL FE
Increment AL
1010 C1
1011 JMP 1009(RRR) EB
Jump the program to 1009
1012 F6
1013 KKK CMP AL,0A 3C Compare AL with
1014 0A immediate data 0A
1015 JB 101D(SSS) 72
Jump if borrow
1016 06
1017 SUB AL,0A 2C Subtract AL with
1018 0A immediate data 0A
1019 INC BL FE
Increment BL
101A C3
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
101B JMP 1013(KKK) EB
Jump the program to 1013
101C F6
101D SSS MOV DL,AL 88
Move data from AL to DL
101E C2
101F MOV AL,BL 88
Move data from BL to AL
1020 D8
1021 ROL AL,01 D0
Rotate left AL by 01
1022 C0
1023 ROL AL,01 D0
Rotate left AL by 01
1024 C0
1025 ROL AL,01 D0
Rotate left AL by 01
1026 C0
1027 ROL AL,01 D0
Rotate left AL by 01
1028 C0
1029 ADD AL,DL 00
Add AL with DL
102A D0
102B MOV [SI+01],AL 88 Move the lower byte
102C 44 CONCLUSION in memory
102D 01 location
102E MOV [SI+02],CL 88 Move the higher byte
102F 44 CONCLUSION in memory
1030 02 location
1031 HLT F4 Stop the program
BINARY TO BCD
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
2001
2000
2002
CONCLUSION:
CONVERSION OF BINARY TO ASCII AND VICEVERSA
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to convert BINARY TO
ASCII and vice versa using 8086 microprocessor.
COMPONENTS REQUIRED:
ALGORITHM:
BINARYTO ASCII
STEP 1: Start the program.
STEP 3: If the input data is greater than the data 0A add 37 from input otherwise
add 30 from the input.
ASCII TO BINARY
STEP 1: Start the program.
STEP 3: If the input data is greater than the data 0Asubtract 37 from input
otherwise subtract 30 from the input.
BINARYTO ASCII
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
2000 2001
FLOWCHART: ASCII TO BINARY
PROGRAM: ASCII TO BINARY
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
1000 MOV BX,2000 B8
Initialize the memory
1001 00
location
1002 20
1003 MOV AL,[BX] 8A Move the data from
1004 07 memory to AL register
1005 CMP AL,OA 3C
Compare AL with data oA
1006 0A
1007 JB 100B(XXX) 72
Jump if borrow occurs
1008 02
1009 SUB AL,07 2C
Subtract AL with data 07
100A 07
100B XXX SUB AL,30 2C
Subtract AL with data 30
100C 30
100D INC BX 43 Increment BX
100E MOV [BX],AL 88
Store the CONCLUSION
100F 07
1010 HLT F4 Stop the program
ASCII TO BINARY
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
2000 2001
CONCLUSION:
CONVERSION OF BINARY TO GRAY
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to convert BINARY TO
GRAY.
COMPONENTS REQUIRED:
ALGORITHM:
STEP 3: Rotate the input content to right and then store in another register.
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
6000 MOV SI,8200 BE
Initialize the memory
6001 00
pointer
6002 82
6003 MOV BL,[SI] 8A Move the input data from
6004 1C memory to BL register
6005 MOV AL,BL 88 Move the data from BL to
6006 D8 AL
6007 SHR AL,01 D0
Shift right AL by 01
6008 C8
6009 XOR AL,BL 30 Perform EX-OR operation
600A D8 between Al and BL
600B INC SI 46 Increment SI
600C MOV [SI],AL 88 Store the CONCLUSION in
600D 04 memory location
600E HLT F4 Stop the program
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8200 8201
CONCLUSION:
FIND AND REPLACE OF DATA
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to find the given element in
set of element and replace it with new value.
COMPONENTS REQUIRED:
ALGORITHM:
STEP 3: Compare elements to be found with set of elements one by one until if
count becomes zero.
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
1000 MOV AX,5000 B8,00,50 Move data segment value
1003 MOV DS,AX 8E,D8 Move AX to DS
1005 CLD FC Clear directional flag
1006 MOV SI,3000 BE
Move the memory address
1007 00
to SI
1008 30
1009 MOV CX,[SI] 8B
Count value move to CX
100A 0C
100B INC SI 46 Increment memory location
100C MOV BL,[SI] 8A Move the data from [SI] to
100D 1C BL
100E MOV DI,2000 BF
Get the input memory
100F 00
address to DI
1010 20
1011 SSS CMP [DI],BL 38
Compare the data
1012 1D
1013 JE 101C(KKK) 74
Jump if equal go to 101C
1014 07
1015 INC DI 47 Increment DI
1016 LOOP 1011(SSS) E2
Jump the address 1011
1017 F9
1018 MOV [DI],0005 C6,05,00 Move count value to DI
101B HLT F4 Stop the program
101C KKK INC SI 46 Increment SI
101D MOV BL,[SI] 8A Move the data from [SI] to
101E 1C BL register
Move the data from BL to
101F MOV [DI],BL 88,1D
[DI]
1021 RET C3 Return the main program
SAMPLE INPUT AND OUTPUT
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
2000
2000
2001
2002 2001
2003
2002
2004
2003
3000
3001 2004
3002
CONCLUSION:
ADDITION OF TWO 3X3 MATRIX
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to add two 3x3 matrix using
8086 microprocessor.
COMPONENTS REQUIRED:
ALGORITHM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
3000 MOV BX,1300 BB
Move the address of matrix
3001 00
one to BX register
3002 13
3003 MOV BP,1400 BD Move the address of
3004 00 second matrix to BP
3005 14 register
3006 MOV SI,0000 BE
Move the data 0000 to SI
3007 00
register
3008 00
3009 MOV DI,1501 BF
Move the output address to
300A 01
DI register
300B 15
300C MOV CL,09 B1 Move count value to CL
300D 09 register
300E XXX MOV AL,[BX+SI] 8A Move the content of [
300F 00 BX+SI] to AL register
3010 ADD AL,[BP+SI] 02 Add the content of [BP+SI]
3011 02 with AL register
3012 MOV [DI],AL 88 Store the CONCLUSION
3013 05 in memory
3014 INC SI 46 Increment SI
3015 INC DI 47 Increment DI
3016 LOOP 300E(XXX) E2
Go to loop 300E
3017 F6
3018 HLT F4 Stop the program
SAMPLE INPUT AND OUTPUT
INPUT
MATRIX A MATRIX B
ADDRESS DATA ADDRESS DATA
1300
1400
1303
1403
1306
1406
OUTPUT
MATRIX C
ADDRESS DATA
1501
1504
1507
CONCLUSION:
PROGRAMS FOR LOGICAL OPERATIONS USING 8086
EX NO:
DATE:
OBJECTVE:
To write and execute an assembly language program for Logical AND, OR , NOT,
XOR, NAND using 8086
COMPONENTS REQUIRED:
PROGRAM:
a) LOGICAL AND:
INPUT OUTPUT
CODE SEGMENT
ASSUME CS: CODE
START: MOV AL, 85H
MOV BL, 99H
AND AL, BL
INT 3H
CODE ENDS
END START
INPUT OUTPUT
b) LOGICAL OR:
b) By using MASM:
LOGICAL OR:
CODE SEGMENT
ASSUMECS: CODE
START: MOV AL, 85H
MOV BL, 99H
OR AL, BL
INT 3H
CODE ENDS
END START
INPUT OUTPUT
By using MASM:
LOGICAL XOR:
CODE SEGMENT
ASSUMECS: CODE
START: MOV AL, 85H
MOV BL, 99H
XOR AL, BL
INT 3H
CODE ENDS
END START
d) LOGICAL NAND:
START
MOV SI,1200
MOV AL, [SI]
MOV BL, [SI+01]
1000
AND AL, BL
NOT AL
MOV [SI+02],AL
END HLT
By using MASM:
LOGICAL NAND:
CODE SEGMENT
ASSUMECS: CODE
START: MOV AL,85H
MOV BL,99H
AND AL,BL
NOT AL
INT 3H
CODE ENDS
END START
d) NOT OPERATION:
CODE SEGMENT
ASSUME CS:CODE
START: MOV AL, 85H
NOT AL
INT 3H
CODE ENDS
END START
VIVA QUESTIONS
CONCLUSION
PROGRAMS FOR MOVE A DATA BLOCK WITHOUT OVERLAP USING 8086
Exp. No:
DATE:
OBJECTVE:
To write and execute an assembly language program to move a block of data without
overlap using 8086
COMPONENTS REQUIRED:
8086 Trainer kit, Key board, power supply, MASM Software
ALGORITHM
Initialize counter
Initialize source block pointer
Initialize destination block pointer
Get the byte from source block
Store the byte in the destination block
Increment source, destination pointers and decrement counter
Repeat steps 4,5 and 6 unit counter equal to zero
Stop
PROGRAM
INPUT OUTPUT
VIVA QUESTIONS
CONCLUSION:
PROGRAMS FOR 16 BIT DECIMAL OPERATIONS USING 8086
Exp. No
DATE:
a) ADDITION
OBJECTVE:
To write and execute an assembly language program for performing the decimal operation of
16 bit numbers with carry.
COMPONENTS REQUIRED:
ALGORITHM:
Step1: Start
INPUT
OUTPUT
ADDRESS DATA
ADDRESS DATA
By using MASM:
VIVA QUESTIONS
CONCLUSION:
PASSWORD CHECKING, PRINT RAM SIZE AND SYSTEM DATE
EXPT NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) for performing the
Arithmetic operation of two byte numbers
APPARATUS REQUIRED:
Today PROC
MOV AX, @data
MOV DS, AX
MOV DX, OFFSET mess1 ; Move string to DX
MOV AH, 09h ; 09h call to display string (DX > AH > DOS)
INT 21H ; Send to DOS
; CX year, DH month, DL day
MOV AH, 2AH ; Get the date (appendix D)
INT 21H ; Send to DOS
PUSH CX ; Move year to the stack
MOV CX, 0 ; Clear CX
MOV CL, DL
PUSH CX ; Move day to stack
MOV CL, DH ; Move month > CL
PUSH CX ; Move month to stack
MOV DH, 0 ; Clear DH
; ************************** DISPLAY MONTH ************************
Set up for division
Dividend will be in DX/AX pair (4 bytes)
Quotient will be in AX
Remainder will be in DX
MOV DX, 0 ; Clear DX
POP AX ; Remove month from stack into AX
MOV CX, 0 ; Initialize the counter
MOV BX, 10 ; Set up the divisor
dividem:
DIV BX ; Divide (will be word sized)
PUSH DX ; Save remainder to stack
ADD CX, 1 ; Add one to counter
MOV DX, 0 ; Clear the remainder
CMP AX, 0 ; Compare quotient to zero
JNE dividem ; If quoient is not zero, go to "dividem:"
divdispm:
Ram size:
ORG 0000H
CLR PSW3
CLR PSW4
CPL A
ADD A, #01H
MOV A,R3
AGAIN: SJMP AGAIN
VIVA QUESTIONS
CONCLUSION:
Counters and Time Delay
EXP.NO: DATE:
AIM:
To write an assembly language program in 8086 to Counters and Time Delay
APPARATUS REQUIRED:
SL.NO ITEM SPECIFICATION QUANTITY
1. Microprocessor kit 8086 1
2. Power Supply +5 V, dc,+12 V dc 1
3. Stepper Motor Interface board - 1
4. Stepper Motor - 1
PROGRAM:
.MODEL SMALL
.DATA
.CODE
MOV DX,@DATA
MOV DS,DX
LEA DX,MSGIN
MOV AH,09H
INT 21H
IN1:
MOV AH,01H
INT 21H
CMP AL,0DH ;
JE NXT
SUB AL,30H
MOV DL,AL
MOV AX,BX
MOV CL,0AH
MUL CL
MOV BX,AX
AND DX,00FFH
ADD BX,DX
MOV DELAYTIME,BX
LOOP IN1
NXT: MOV CX,DELAYTIME
MOV DL,10
MOV AH,02H
INT 21H
LEA SI,MSG1
LP: PUSH DX
MOV DL,[SI]
CMP DL,'$'
JE NXT2
MOV AH,02H
INT 21H
ADD SI,1
POP DX
MOV DI,DELAYTIME
MOV AH, 0
INT 1Ah
MOV BX, DX
Delay:
MOV AH, 0
INT 1Ah
SUB DX, BX
CMP DI, DX
JA Delay
LOOP LP
END
VIVA QUESTIONS
CONCLUSION:
8051
MICROCONTROLLER
EXECUTION PROCEDURE FOR 8051
Writing a alp program into 8051:
Switch on kit
Press reset
Press A (give starting address)
Press enter
st
Enter 1 mnemonic
Press enter
Enter 2nd mnemonic
Press enter
---
---
---
Enter nth mnemonic
Press enter
Press enter
Press enter
Display: A D G M T S
To compile:
Press G (give starting address)
Press enter
Display: program executed
Result:
Press R
A, B, R0, -------, Rn
8-BIT AND 16-BIT ADDITION
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to perform 8-bit and 16-bit
addition using 8051 micro controller.
COMPONENTS REQUIRED:
ALGORITHM:
40
42
41
8-BIT ADDITION (EXTERNAL MEMORY)
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
9000 MOV R4,#00 7C Move the data 00 to R4
9001 00
9002 MOV DPTR,#8100 90 Initialize the memory
9003 00 pointer to DPTR
9004 81
9005 MOVX A,@DPTR E0 Move DPTR to A
9006 INC DPTR A3 Increment DPTR
9007 MOV R0,A F8 Move A to R0
9008 MOVX A,@DPTR E0 Move DPTR to A
9009 ADD A,R0 28 Add A and R0
900A JNC 900D(AA) 05 Jump to 900D if no carry
900B 80 occurs
900C INC R4 0C Increment R4
900D AA INC DPTR A3 Increment DPTR
900E MOVX @DPTR,A F0 Move A to DPTR
900F INC DPTR A3 Increment DPTR
9010 MOV A,R4 EC Move r4 to A
9011 MOVX @DPTR,A F0 Move A to DPTR
9012 SJMP 9000 80 Short jump to 9000
9013 EC
8101 8103
16-BIT ADDITION
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
9500 MOV A,#2F 74 Move the data to
9501 2F accumulator
9502 MOV R1,#2F 79
Move the data to R1 reg
9503 2F
9504 MOV R2,#02 7A
Move the data to R2 reg
9505 02
9506 MOV R3,#12 7B
Move the data to R3 reg
9507 12
9508 ADD A,R2 2A Add A and R2 reg
9509 MOV DPTR,#8500 90
Initialized memory pointer
950A 00
by data pointer
950B 85
950C MOVX @DPTR,A E0 Move A t0 DPTR
950D MOV A,R1 E9 Move R1 to Accumulator
950E ADD A,R3 2B Add A and R3 reg
950F INC DPTR A3 Increment DPTR
9510 MOVX @DPTR,A E0 Move A t0 DPTR
9511 SJMP 9500 80 Short jump to the address
9512 ED 9500
16-BIT ADDITION
INPUT OUTPUT
IMMEDIATE DATA ADDRESS DATA
DATA 1 8500
DATA2 8501
BY USING MASM:
16 BIT ADDITION
$MOD51
ORG 0000H
MOV DPTR, #0101H
MOVX A,@DPTR
MOV B, A
DEC DPL
MOV A,@DPTR
ADD A, B
INC DPTR
INC DPTR
MOVX @DPTR, A
CLR A
ADDC A, #00H
INC DPTR
MOVX @DPTR, A
STOP: SJMP STOP
END
CONCLUSION:
8-BIT AND 16-BIT SUBTRACTION
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to perform 8-bit and 16-bit
subtraction using 8051 micro controller.
COMPONENTS REQUIRED:
ALGORITHM:
SAMPLE INPUT/OUTPUT
DATA 1
40
DATA 2
8-BIT SUBTRACTION (EXTERNAL MEMORY)
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
A300 MOV A,#24 74 Move the data to
A301 24 accumulator
A302 MOV R3,#02 7B Move the data to R3
A303 02 register
SUBB A,R3 9B Subtract R3 from the
A304
content of accumulator
A305 MOV DPTR,#8100 90
Initialized memory pointer
A306 00
by data pointer
A307 81
A308 MOVX @DPTR,A F0 Move A to DPTR
A309 SJMP A300 80
Short jump to A300
A30A F5
SAMPLE INPUT/OUTPUT
16-BIT SUBTRACTION
INPUT OUTPUT
IMMEDIATE DATA ADDRESS DATA
DATA 1 9300
DATA 2 9301
BY USING MASM:
16 BIT SUBTRACTION
$MOD51
ORG 0000H
MOV DPTR, #0101H
MOVX A,@DPTR
MOV B, A
DEC DPL
MOVX @DPTR, A
CLR C
SUBB A,B
INC DPTR
INC DPTR
MOVX @DPTR, A
CLR A
ADDC A, #00H
INC DPTR.
MOVX @DPTR,A
STOP: SJMP STOP
END
CONCLUSION:
8-BIT MULTIPLICATION
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to perform 8-bit multiplication
using 8051 micro controller.
COMPONENTS REQUIRED:
ALGORITHM:
41 43
8-BIT MULTIPLICATION (EXTERNAL MEMORY)
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
8000 MOV A,#55 74 Move the data to
8001 55 accumulator
8002 MOV B,#04 75
8003 04 Move the data to B
8004 0B
8005 MUL AB A4 Multiply A and B
8006 MOV DPTR,#8100 90
Initialized memory pointer
8007 00
by data pointer
8008 81
8009 MOVX @DPTR,A F0 Move A t0 DPTR
800A INC DPTR A3 Increment DPTR
800B MOV A,B E5
Move B to A
800C F0
800D MOVX @DPTR,A E0 Move A t0 DPTR
800E SJMP 8000 80 Short jump to the address
800F F0 8000
DATA 2 8101
BY USING MASM:
.MULTIPLICATION
$MOD51
ORG 0000H
MOV DPTR, # 0101H
MOVX A,@DPTR
MOV B, A
DEC DPL
MOVX A, @DPTR
MUL AB
INC DPTR
INC DPTR
MOVX @DPTR, A
MOV A, B
INC DPTR
MOVX @DPTR, A
STOP: SJMP STOP
END
CONCLUSION:
8-BIT DIVISION
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to perform 8-bit division using
8051 micro controller.
COMPONENTS REQUIRED:
ALGORITHM:
41 43
8-BIT DIVISION (EXTERNAL MEMORY)
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
8000 MOV A,#55 74 Move the data to
8001 55 accumulator
DATA 1 8100
DATA 2 8101
BY USING MASM:
D.DIVISION
$MOD51
ORG 0000H
MOV DPTR, # 0101H
MOV X A,@DPTR
MOV B, A
DEC DPL
MOVX A, @DPTR
DIV AB
INC DPTR
INC DPTR
MOVX @DPTR, A
MOV A, B
INC DPTR
MOVX @DPTR, A
STOP: SJMP STOP
END
VIVA QUESTIONS
1. Explain the logic behind the programs for arithmetic operations using 8051.
2. What is a Micro controller? What is the difference between microprocessor & micro
controller?
CONCLUSION:
FIND TWO’S COMPLEMENT OF A NUMBER
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to perform two‟s complement
of a number using 8051 micro controller.
COMPONENTS REQUIRED:
ALGORITHM:
STEP 3: Complement the input data and then add with 01.
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
8000 MOV A,#03 74 Move immediate data to
8001 03 Accumulator
CPL A F4 Complement
8002
Accumulator
8003 ADD A,#01 24 Add with A and
8004 01 immediate data 01
8005 MOV DPTR,#8100 90 Move the
8006 00 CONCLUSION address
8007 81 to DPTR
MOVX @DPTR,A F0 Store the CONCLUSION
8008 in corresponding memory
location
8009 SJMP 8000 80 Short jump
800A F5
INPUT OUTPUT
IMMEDIATE
ADDRESS DATA
DATA
8100
BY USING MASM:
CONCLUSION:
FIND SQUARE OF A NUMBER
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to find square of a number
using 8051 microcontroller.
COMPONENTS REQUIRED:
ALGORITHM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
8000 MOV DPTR,#8100 Get the input from memory
8001 location
8002
MOVX A,@DPTR Move data from memory to
8003
A
8004 MOV B,A Move the content of A to B
MOV R0,A Move the content of A to
8005
R0
8006 MOV A,#00 Move the immediate data
8007 00 to Accumulator
XXX ADD A,B Add the content of A with
8008
B
8009 DEC RO Decrement the count value
800A JNZ 8008(XXX) Jump if not zero
800B
800C INC DPTR Increment memory pointer
800D MOVX @DPTR,A Store the CONCLUSION.
800E SJMP 8000 Stop the program
800F
8100 8101
BY USING MASM:
CONCLUSION:
.
FIND CUBE OF A NUMBER
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) to find cube of a number using
8051 microcontroller.
COMPONENTS REQUIRED:
ALGORITHM:
STEP 1: Start the program.
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
8000 MOV A,#00 Clear the accumulator
8001 content
8002 MOV B,#03 Move the input to B
8003 register
8004 XXX ADD A,#03 Add accumulator content
8005 with immediate data
8006 DEC B Decrement count value
8007 JNZ 8004(XXX) Jump if no zero
8008
8009 MOV R0,A Move data from A to R0
800A MOV B,#02 Move the data to B register
800B
YYY ADD A,R0 Add the content of A with
800C
R0
800D DEC B Decrement B register
800E JNZ 800C(YYY) Jump if no zero to
800F mentioned address
8010 MOV DPTR,#8100 Initialize the output
8011 memory address
8012
8013 MOVX @DPTR,A Store the CONCLUSION
8014 SJMP 8000 Short jump to address
8015
SAMPLE INPUT AND OUTPUT
INPUT OUTPUT
IMMEDIATE DATA ADDRESS DATA
DATA 8100
BY USING MASM:
CONCLUSION:
8086 INTERFACING
STEPPER MOTOR INTERFACING
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) for interfacing stepper motor
Using 8086 microprocessor.
COMPONENTS REQUIRED:
ALGORITHM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
CLOCKWISE DIRECTION
5000 MOV DX,00C0 BA
Move the port address to
5001 C0
DX register
5002 00
5003 MOV AL,66 B0 Store data to energise
5004 66 phase2 and phase3
Data moved into port
5005 SSS OUT DX,AL EE
address
5006 CALL 500D(XXX) E8
5007 04 Delay between two steps
5008 00
5009 ROR AL,1 D0 Rotate right the content of
500A C8 the accumulator
500B JMP 5005(SSS) E8 Repeat the above process
500C F8 for ever
DELAY PROGRAM
500D XXX MOV CX,0500 B9
Move the count value to
500E 00
CX register
500F 05
5010 GGG DEC CX 49 Decrement CX value
5011 JNE 5010(GGG) 75 Jump if the value of CX is
5012 FD not equal (or)zero
5013 RET C3 Return
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
ANTI-CLOCKWISE DIRECTION
5050 MOV DX,00C0 BA
Move the port address to
5051 C0
DX register
5052 00
5053 MOV AL,66 B0 Store data to energise
5054 66 phase2 and phase3
Data moved into port
5055 KKK OUT DX,AL EE
address
5056 CALL 500D(XXX) E8
5057 04 Delay between two steps
5058 00
5059 ROL AL,1 D0 Rotate left the content of
505A C8 the accumulator
505B JMP 5055(KKK) E8 Repeat the above process
505C F8 for ever
90° PHASE SHIFT
5100 MOV AH,32 B4 Move count value 32 to
5101 32 AH register
5102 MOV DX,00C0 B4
Move the port address to
5103 C0
DX register
5104 00
5105 MOV AL,66 B0 Store data to energise
5106 66 phase2 and phase3
5107 DDD OUT DX,AL EE The value sent to port
5108 CALL 5108 E8
Delay between two steps
5109 02
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
510A FF
510B ROL AL,1 D0 Rotate left the value of
510C C0 AL
510D DEC AH FE Decrement the count
510E CC value
510F JNE 5107(DDD) 75
Jump if not equal
5110 F6
5111 RRR NOP 90 No operation
5112 JMP 5111(RRR) EB
Jump program to 5111
5113 FD
CONCLUSION:
8255 INTERFACING
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) for interfacing of 8255
Using 8086 microprocessor.
COMPONENTS REQUIRED:
S.NO COMPONENTS SPECIFICATION QUANTITY
1. Microprocessor kit 8086 kit 1
2. Power Supply +5 V dc 1
3. Key board - 1
4. 8255interface card - 1
ALGORITHM:
STEP 2: Initialize the 8255 ports by sending the control word 82.
JUMPER SETTINGS:
1. Short the pins P2 and P11 0f J1 and short pins P3 and P10, so that port B input buffer
is enabled.
2. Short the pins P1 and P12 of J2 and short pins P4 and P9, so that Port A output buffer
is enabled.
FLOW CHART:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
5000 XXX MOV DX,00C6 BA
Move the control word
5001 C6
address to DX register
5002 00
5003 MOV AL,82 B0 Move the count value 82
5004 82 to the accumulator
5005 OUT DX,AL EE Count value sent to port
5006 MOV DX,00C2 BA
5007 C2 Set port B as input port
5008 00
Input port value to
5009 IN AL,DX EC
accumulator
500A MOV DX,00C0 BA
500B C0 Set port A as output port
500C 00
Accumulator value to
500D OUT DX,AL EE
output port
500E JMP 5000(XXX) EB Jump the program to 5000
CONCLUSION:
DAC INTERFACING
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) for interfacing of DAC
Using 8086 microprocessor.
COMPONENTS REQUIRED:
ALGORITHM:
SQUARE WAVE:
STEP 1: Start the program.
SAWTOOTH WAVE:
SAWTOOTH WAVE:
TRIANGULAR WAVE:
PROGRAM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
SQURE WAVE GENERATION
5100 MOV AX,0000 B8
Move the value 0000 to
5101 00
AX register
5102 00
5103 MOV DS,AX 8E Move the value from Ax to
5104 D8 DS
5105 MOV DX,00C0 BA
Move the port address to
5106 C0
DX register
5107 00
5108 KKK MOV AL,00 B0 Data to be set DAC output
5109 00 to 0 level
510A OUT DX,AL EE Send data to DAC
510B CALL 525F(XXX) E8
510C 51 Off time delay
510D 01
510E MOV AL,FF B0 Data to be set DAC output
510F FF to 1 level
5110 OUT DX,AL EE Send data to DAC
5111 CALL 525F(XXX) E8
5112 4B On time delay
5113 01
5114 JMP 5108(KKK) EB
Repeat process
5115 F2
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
TRIANGULAR WAVE GENERATION
5150 MOV AX,0000 B8
Move the value 0000 to AX
5151 00
register
5152 00
5153 MOV DS,AX 8E Move the value from Ax to
5154 D8 DS
5155 MOV DX,00C0 BA
Move the port address to
5156 C0
DX register
5157 00
5158 DDD MOV AL,00 B0
Start DAC output from 0V
5159 00
515A SSS OUT DX,AL EE Send data to DAC
515B INC AL FE
Increment AL
515C C0
515D JNE 515A(SSS) 75
Repeat until AL becomes 0
515E FB
515F MOV AL,FF B0 Move the value FF to AL
5160 FF register
5161 KKK OUT DX,AL EE Send data to DAC
5162 DEC AL FE
Decrement AL value
5163 C8
5164 JNE 5161(KKK) 75
Repeat until AL becomes 0
5165 FB
5166 JMP 5158(DDD) EB Repeat process
5167 F3
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
SAW TOOTH WAVE GENERATION
5200 MOV AX,0000 B8
Move the value 0000 to AX
5201 00
register
5202 00
5203 MOV DS,AX 8E Move the value from Ax to
5204 D8 DS
5205 MOV DX,00C0 BA
Move the port address to
5206 C0
DX register
5207 00
5208 MOV AL,00 B0 Move the value 00 to AL
5209 00 register
520A ABC OUT DX,AL EE Send data to DAC
520B INC AL FE
Increment AL
520C C0
520D JMP 520A(ABC) EB
Repeat process
520E FB
DELAY PROGRAM
525F MOV CX,00FF B9
5260 FF Move the count value to CX
5261 00
5262 MMM DEC CX 49 Decrement CX
5263 JNE 5262(MMM) 75
Jump if not equal
5264 FD
5265 RET C3 Return the program
OBSERVATION
S.No TIME PERIOD(msec) AMPLITUDE (volts)
CONCLUSION:
COUNTER DESIGN 8253 INTERFACING
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) for interfacing of counter
using8086 microprocessor .
COMPONENTS REQUIRED:
ALGORITHM:
STEP 1: Start the program.
STEP 2: Set a control word for counter 2 in mode -3(Square wave generation).
STEP 3: Give the lower byte of count value
STEP 4:Give the higher byte of count value.
STEP 5: Stop the program.
CONTROL WORD FORMAT:
FLOW CHART:
PROGRAM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
5050 MOV DX,00C6 BA
Move the port address to
5051 C6
DX register
5052 00
5053 MOV AL,B6 B0 Move count value to AL
5054 B6 register
5055 OUT DX,AL EE Move AL value to DX
5056 MOV DX,00C4 BA
Move the port address to
5057 C4
DX register
5058 00
5059 MOV AL,E8 B0 Move lower byte of count
505A E8 value to AL register
505B OUT DX,AL EE Move AL value to DX
505C MOV AL,03 B0 Move higher byte of count
505D 03 value to AL register
505E OUT DX,AL EE Move AL value to DX
505F XXX NOP 90 No operation
5060 JMP 505F(XXX) EB
Jump program
5061 FD
OBSERVATION
S.No TIME PERIOD(msec) AMPLITUDE (volts)
CONCLUSION:
KEYBOARD AND DISPLAY INTERFACING
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) for interfacing of keyboard and
display Using 8086 microprocessor.
COMPONENTS REQUIRED:
ALGORITHM:
STEP 1: Start the program.
STEP 2: Initialize 8279 with 8 digits of display by sending command (00) to port.
STEP 3: Locate the first digit address with auto increment mode by sending
command(90) to port..
STEP 4:Send seven- segment code(3F)for ”0”.
STEP 5: Send seven- segment code(3F)for ”1”..
STEP 6: Send seven- segment code(3F)for ”2”..
STEP 7: Send seven- segment code(3F)for ”3”..
STEP 8: stop the program.
FLOW CHART:
PROGRAM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
5000 MOV DX,00C2 BA
Move the port address to
5001 C2
DX register
5002 00
5003 MOV AL,00 B0
Move 00 to AL register
5004 00
5005 OUT DX,AL EE Move AL to 00C2
5006 MOV AL,90 B0
Move 90 to AL register
5007 90
5008 OUT DX,AL EE Move AL to 00C2
5009 MOV DX,00C0 BA
Move the port address to
500A C0
DX register
500B 00
500C MOV AL,3F B0 Move 3F to AL register to
500D 3F display”0”
500E OUT DX,AL EE Move AL to 00C0
500F MOV AL,06 B0 Move 06 to AL register to
5010 06 display”1”
5011 OUT DX,AL EE Move AL to 00C0
5012 MOV AL,5B B0 Move 5B to AL register to
5013 5B display”2”
5014 OUT DX,AL EE Move AL to 00C0
5015 MOV AL,4F B0,4F Move 4F to AL register to display”3”
CONCLUSION:
TRAFFIC LIGHT CONTROLLER (TLC) INTERFACING
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) for interfacing of traffic light
controller using8086 microprocessor .
COMPONENTS REQUIRED:
ALGORITHM:
STEP 1: Start the program.
STEP 2: Initialize all the three ports of 8255 as output ports.
STEP 3: Turn on DON‟T WALK signals in all the roads.
STEP 4: Turn on GO signal in road 1.
STEP 5: Turn on READY signal in road 2 and STOP signal in all other roads.
STEP 6: Turn on GO signal in road 2.
STEP 7: Turn on READY signal in road 3 and STOP signal in all other roads.
STEP 8: Turn on GO signal in road 3.
STEP 9: Turn on READY signal in road 4 and STOP signal in all other roads
STEP 10: Turn on GO signal in road 4
PROGRAM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
5000 MOV BX,5029 BB
Initialize BX with BIT
5001 29
PATTERNS
5002 50
5003 MOV CX,09 B9
5004 09 Move the count value
5005 00
5006 MOV AL,80 B0
Initialize all ports
5007 80
5008 MOV DX,0046 BA
5009 46 Control port address
500A 00
500B OUT DX,AL EE Set all the ports
500C MOV AL,[BX] 8A
Get the bit patterns
500D 07
500E MOV DX,0040 BA
500F 40 Move the port A address
5010 00
5011 OUT DX,AL EE
5012 INC BX 43
5013 MOV AL,[BX] 8A
5014 07
5015 INC DX 42
5016 INC DX 42
5017 OUT DX,AL EE
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
5018 INC BX 43
5019 MOV AL,[BX] BA,07
501B INC DX 42
501C INC DX 42
501D OUT DX,AL EE
501E INC BX 43
501F MOV AL,[BX] 8A
Get the bit for time delay
5020 07
5021 CALL 504D E8
5022 29 Delay routine for 1 sec
5023 00
5024 INC BX 43
5025 LOOP 500C E2
Repeat up to 9 cycles
5026 E5
5027 JMP 5000 EB
5028 D7 Repeat from cycle 1
5051 DAA 27
BIT PATTERNS
5029 B4 60 09 20
502D 9C 40 0B 05
5031 96 40 0B 20
5035 E4 40 0B 05
5039 A4 41 0B 20
503D B4 40 0E 05
5041 B4 40 1A 20
5045 31 12 23 10
5049 B4 C0 09 05
CONCLUSION:
PRINTER STATUS
EXP.NO:
DATE:
AIM:
To display the Printer in the display
Status
PROGRAM:
CONCLUSION
8051 INTERFACING
STEPPER MOTOR INTERFACING
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) for interfacing stepper motor
using 8051 micro controller.
COMPONENTS REQUIRED:
ALGORITHM:
STEP 1: Start the program.
STEP 2: Move the data 66 to Accumulator.
STEP 3: Send the data in Acc to I/O port.
STEP 4:Wait for some time (small delay).
STEP 5: Rotate the Acc contents left/right by one bit.
STEP 6: Repeat from step 2.
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
CLOCKWISE DIRECTION
8000 MOV DPTR,#FFC0 90
Move port address to DX
8001 FF
register
8002 C0
8003 MOV A,#66 74 Store data to energise
8004 66 phase2 and phase3
Move Accumulator value to
8005 AAA MOVX @DPTR,A F0
DPTR
8006 ACALL 800B(XXX) 11
Delay between two steps
8007 0B
8008 RR A 03 Rotate right “A”
8009 SJMP 8005(AAA) 80 Repeat the above process
800A FA for ever
DELAY PROGRAM
800B XXX MOV R0,#0A 78 Move immediate data 0A to
800C 0A R0 register
800D MOV R1,#FF 79 Move immediate data FF to
800E FF R1 register
800F DJNZ R1,800F D9 Decrement Jump if not zero
8010 FE to 800F
8011 DJNZ R0,800D D8 Decrement Jump if not zero
8012 FA to 800D
8013 RET 22 Return
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
ANTI-CLOCK WISE DIRECTION
8040 MOV DPTR,#FFC0 90
Move port address to DX
8041 FF
register
8042 C0
8043 MOV A,#66 74 Store data to energise
8044 66 phase2 and phase3
8045 BBB MOVX @DPTR,A F0 Move A value to DPTR
8046 ACALL 800B(XXX) 11
Delay between two steps
8047 0B
8048 RL A 23 Rotate Left “A”
Repeat the above process
8049 SJMP 8045(BBB) 80,FA
for ever
90° PHASE SHIFT
8060 MOV DPTR,#FFC0 90,FF,C0 Move port address to DX
8063 MOV A,#66 74 Store data to energise
8064 66 phase2 and phase3
8065 MOV R2,#32 7A Move count value to R2 for
8066 32 90° shift
8067 MOVX @DPTR,A F0 Move „A‟value to DPTR
8068 ACALL 800B(XXX) 11
Delay between two steps
8069 0B
806A RL A 23 Rotate Left “A”
806B DJNZ R2,8067 DA Decrement Jump if not
806C FA zero to 800F
Repeat the above process
806D SJMP 806D 80,FE
for ever
CONCLUSION:
8255 INTERFACING
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) for interfacing of 8255
Using8051 microcontroller.
COMPONENTS REQUIRED:
S.NO COMPONENTS SPECIFICATION QUANTITY
1. Microcontroller kit 8051 kit 1
2. Power Supply +5 V dc 1
3. Key board - 1
4. 8255interface card - 1
ALGORITHM:
STEP 1: Start the program.STEP 2: Initialize the 8255 ports by sending the control
word 82.STEP 3: Set port B as input port by proper jumper settings.STEP 4:Set port A
as output port by proper jumper settings.STEP 5: Read the switches at port B. STEP 6:
Display the reading port A.
JUMPER SETTINGS:
1. Short the pins P2 and P11 0f J1 and short pins P3 and P10,so that port B input
buffer is enabled.
2. Short the pins P1 and P12 of J2 and short pins P4 and P9 ,so that Port A output
buffer is enabled.
FLOW CHART:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
8000 MOV A,#82 74 Move the control word to
8001 82 accumulator
8002 MOV DPTR,#FFC6 90
Move the port address to
8003 FF
the DPTR
8004 C6
8005 MOVX @DPTR,A F0 Move A to DPTR
8006 MOV DPTR,#FFC2 90
Move port B address to
8007 FF
DPTR
8008 C2
8009 MOVX A,@DPTR F0 Set port B as input
800A MOV DPTR,#FFC0 90
Move port A address to
800B FF
DPTR
800C C0
800D MOVX @DPTR,A F0 Set port A as output
800E SJMP 800E 80 Short jump to address
800F FE 800E
CONCLUSION:
DAC INTERFACING
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) for interfacing of DAC
Using 8051 microcontroller.
COMPONENTS REQUIRED:
ALGORITHM:
SQUARE WAVE:
STEP 1: Start the program.
STEP 2: Load accumulator with 00 and send it to the D/A convertor.
STEP 3: Call a delay of 1ms which is the off-time delay.
STEP 4:Initialize D/A convertor by sending FF to the output port.
STEP 5: Call a delay of 1ms which is the on-time delay.
STEP 6: Repeat the loop.
TRIANGULAR WAVE:
STEP 1: Start the program.
STEP 2: Load accumulator with 00 and send it to the D/A convertor.
STEP 3: Increment the data and send it to the accumulator.
STEP 4:Repeat the loop until Accumulator reaches 00.
STEP 5: Load accumulator with FF and send it to the D/A convertor.
STEP 6: Decrement the data and send it to the accumulator.
STEP 7:Repeat the loop until Accumulator reaches 00.
STEP 8:Repeat the process again and again.
SAWTOOTH WAVE:
STEP 1: Start the program.
STEP 2: Load accumulator with 00 and send it to the D/A convertor.
STEP 3: Increment the data and send it to the accumulator.
STEP 4:Repeat the process unconditionally.
FLOW CHART:
SQUARE WAVE
SAWTOOTH WAVE:
TRIANGULAR WAVE:
PROGRAM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
SQUARE WAVE GENERATION
8200 MOV DPTR,#FFC0 90
Move port address to data
8201 FF
pointer
8202 C0
8203 MOV A,#00 74 Data to set DAC output to
8204 00 0 level
8205 MOVX @DPTR,A F0 Move data from A to port
8206 MOV R0,#FF 78
Off time delay
8207 FF
8208 DJNZ R0,8208 D8 Decrement and jump not
8209 FE zero
820A MOV A,#FF 74 Data to set DAC output to
820B FF 1 level
820C MOVX @DPTR,A F0 Move data from A to port
820D MOV R0,#FF 78
On time delay
820E FF
820F DJNZ R0,820F D8 Decrement and jump not
8210 FE zero
8211 SJMP 8203 80
Repeat process
8212 F0
TRIANGULAR WAVE GENERATION
8240 MOV DPTR,#FFC0 90
Move port address to data
8241 FF
pointer
8242 C0
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
8243 MOV A,#00 74
Start DAC output from 0V
8244 00
8245 MOVX @DPTR,A F0 Move data from A to port
8246 INC A 04 Increment A
8247 CJNE A,#FF,8245 B4
Repeat until A becomes
8248 FF
FF
8249 FB
824A MOVX @DPTR,A F0 Move data from A to port
824B DEC A 14 Decrement A
824C CJNE A,#00,824A B4
Repeat until A becomes
824D 00
00
824E FB
824F SJMP 8243 80,F2 Repeat process
SAWTOOTH WAVE GENERATION
8260 MOV DPTR,#FFC0 90
Move port address to data
8261 FF
pointer
8262 C0
8263 KKK MOV A,#00 74 Move data 00 to
8264 00 accumulator
8265 MOVX @DPTR,A F0 Move data from A to port
8266 INC A 04 Increment A
8267 SJMP 8265(KKK) 80
Repeat process
8268 FC
OBSERVATION
S.No TIME PERIOD(msec) AMPLITUDE (volts)
CONCLUSION:
COUNTER DESIGN 8253 INTERFACING
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) for interfacing of counterusing
8051microcontroller.
COMPONENTS REQUIRED:
ALGORITHM:
STEP 1: Start the program.
STEP 2: Set a control word for counter 2 in mode -3(Square wave generation).
STEP 3: Give the lower byte of count value
STEP 4:Give the higher byte of count value.
STEP 5: Stop the program.
CONTROL WORD FORMAT:
FLOW CHART:
PROGRAM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
8000 MOV A,#B6 74 Move control word value
8001 B6 to A register
8002 MOV DPTR,#FFC6 90
Move the port address to
8003 FF
DPTR
8004 C6
Move the content of A to
8005 MOVX @DPTR,A F0
DPTR
8006 MOV DPTR,#FFC4 90
Move the port address to
8007 FF
DPTR
8008 C4
8009 MOV A,#E8 74 Move the lower byte
count value to
800A E8
Accumulator
Move the content of A to
800B MOVX @DPTR,A F0
DPTR
800C MOV A,#03 74 Move the higher byte
count value to
800D 03
Accumulator
Move the content of A to
800E MOVX @DPTR,A F0
DPTR
800F SJMP 8000 80
Short jump to 8000
8010 EF
OBSERVATION
S.No TIME PERIOD(msec) AMPLITUDE (volts)
CONCLUSION:
KEYBOARD AND DISPLAY INTERFACING
EX NO:
DATE:
OBJECTIVE:
To write an Assembly Language Program (ALP) for interfacing of keyboard and
display using8051microcontroller.
COMPONENTS REQUIRED:
ALGORITHM:
STEP 1: Start the program.
STEP 2: Initialize 8279 with 8 digits of display by sending command (00) to port.
STEP 3: Locate the first digit address with auto increment mode by sending
command (90) to port.
STEP 4:Send seven- segment code(3F)for ”0”.
STEP 5: Send seven- segment code(3F)for ”1”.
STEP 6: Send seven- segment code(3F)for ”2”.
STEP 7: Send seven- segment code(3F)for ”3”.
STEP 8: stop the program.
FLOW CHART:
PROGRAM:
MNEMONICS HEX
ADDRESS LABEL COMMENTS
OPCODE OPERAND CODE
8000 MOV A,#00 74 Move data 00 to
8001 00 accumulator
8002 MOV DPTR,#FFC2 90
Move port address to data
8003 FF
pointer
8004 01
8005 MOVX @DPTR,A F0 Move data from A to port
8006 MOV A,#90 74 Move data 90 to
8007 90 accumulator
8008 MOVX @DPTR,A F0 Move data from A to port
8009 MOV DPTR,#FFC0 90
Move port address to data
800A FF
pointer
800B 00
800C MOV A,#3F 74 Move data 3F to
800D 3F accumulator
800E MOVX @DPTR,A F0 Move data from A to port
800F MOV A,#06 74 Move data 06 to
8010 06 accumulator
8011 MOVX @DPTR,A F0 Move data from A to port
Move data 5B to
8012 MOV A,#5B 74,5B
accumulator
8014 MOVX @DPTR,A F0 Move data from A to port
Move data 4F to
8015 MOV A,#4F 74,4F
accumulator
8017 MOVX @DPTR,A F0 Move data from A to port
8018 SJMP 8000 80,FE Short jump to address
SEVEN SEGMENT DISPLAY:
CONCLUSION:
DIGITAL CLOCK
EXP NO.:
DATE:
OBJECTIVE :
To display the digital clock specifically by displaying the hours, minutes and seconds
using 8086 kits
COMPONENTS required :
EXP NO.:
DATE:
OBJECTIVE: To connect two 8086 microprocessor kits and to serially communicate with
each other by considering transmitter and receiver kits.
COMPONENTS REQUIRED:
Procedure
4. Interface the two kits with 9-9 serial cable in the serial port of the microprocessor kits. (LCD kit means
PC-PC cable. LED kit means kit-kit cable)
5. Enter the data in transmitter kit use the memory location 1500.