0% found this document useful (0 votes)
20 views81 pages

Cse-Mpmc Lab Manual

The document is a student manual for the Microprocessor and Microcontroller Lab course (EBEC22L07) for B.Tech Computer Science and Engineering students. It includes a list of experiments covering basic arithmetic operations, sorting, searching, interfacing with peripherals, and logical operations using 8086 and 8051 microprocessors. Each experiment outlines the aim, required apparatus, algorithm, program, and results for various operations such as addition, subtraction, multiplication, division, and logical operations.

Uploaded by

pantpink858
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views81 pages

Cse-Mpmc Lab Manual

The document is a student manual for the Microprocessor and Microcontroller Lab course (EBEC22L07) for B.Tech Computer Science and Engineering students. It includes a list of experiments covering basic arithmetic operations, sorting, searching, interfacing with peripherals, and logical operations using 8086 and 8051 microprocessors. Each experiment outlines the aim, required apparatus, algorithm, program, and results for various operations such as addition, subtraction, multiplication, division, and logical operations.

Uploaded by

pantpink858
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 81

EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

MICROPROCESSOR AND MICROCONTROLLER LAB


STUDENT MAUANL

DEGREE B.TECH
BRANCH COMPUTER SCIENCE AND ENGINEERING
SUBJECT CODE EBEC22IL2
SUBJECT NAME MICROPROCESSOR AND MICROCONTROLLER LAB
REGULATION 2022

1
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB
LIST OF EXPERIMENTS

PAGE
S.NO EXPERIMENT NAME
NO
8086 PROGRAM USING KITS/MASM
1 BASIC ARITHMETIC AND LOGICAL OPERATIONS
1A 16-BIT DATA ADDITION AND SUBTRACTION
1B 16-BIT MULTIPLICATION AND DIVISION
1C LOGICAL OPERATIONS
1D MOVE A DATA BLOCK WITHOUT OVER LAP
2 SORTING AND SEARCHING
2A ASENDING AND DESENDING
2B SEARCH FOR A GIVEN DATA
PERIPHERALS AND INTERFACING EXPERIMENTS
3 TRAFFIC LIGHT CONTROL
4 STEPPER MOTOR CONTROL
5 KEYBOARD AND DISPLAY
6A SERIAL INTERFACE
6B PARALLEL INTERFACE
7 ADC AND DAC INTERFACING
8 WAVE FORM GENERATION
8051 EXPERIMENTS USING KITS/MASM
9 BASIC ARITHMETIC
9A 8 – BIT ADDITION AND SUBTRACTION
9B 8 – BIT MULTIPLICATION AND DIVISION
10 LOGICAL OPERATIONS
11 MOVE A DATA BLOCK WITHOUT OVER LAP
12 SORTING AND SEARCHING
8086/8051 PROGRAMS USING KITS/MASM
13 CODE CONVERSION
13 A DESIMAL ARITHMETIC
13 B MATRIX OPERATIONS

2
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

8086 PROGRAM USING KITS/MASM

EX NO: 1A Addition3 of two 16 bit numbers using 8086


EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB
DATE :
AIM:
Write and execute ALP [Assembly language program] to add two 16 bit numbers
using 8086 microprocessor kit.

APPARATUS REQUIRED:
8086 Microprocessor Kit, Power Chord, Keyboard.

ALGORITHM:
Step1: Get two 16 bit numbers from input memory location.
Step2: Add the two 16 bit numbers.
Step3: Store the result into output memory location.

PROGRAM:
16 BIT ADDITIONS

MEMORY MNEMONICS OPCODE COMMENTS


LOCATION
MOVE THE DATA FROM MEMORY
1000 MOV AX,[1100H] 8B, 06, 00, 11
TO ACCUMULATOR (AX REGISTER)
MOVE THE DATA FROM MEMORY
1004 MOV BX,[1102H] 8B, 2E, 02, 11
TO BX REGISTER
1008 ADD AX,BX 01, D8 ADD THE CONTENT OF AX & BX
STORE THE RESULT FROM AX TO
100A MOV[1200H],AX 89, 06, 00, 12
MEMORY
100E HLT F4 STOP THE PROGRAM

FLOW CHART:

4
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

Observation:
INPUT:

MEMORY GIVEN
LOCATION DATA
1100 H 33 H
1101 H 33 H
1102 H 22 H
1103 H 22 H

OUTPUT:

MEMORY OUTPUT
LOCATION
1200 H 55 H
1201 H 55 H

RESULT:

Thus the Result of Addition of Two 16 Bit Numbers Using 8086 Is Executed and Verified Successfully.

5
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB
EX NO: 1B
SUBTRACTION OF TWO 16 BIT NUMBERS USING 8086
DATE :
AIM:
Write and execute ALP [Assembly language program] to subtract two 16 bit numbers using
8086 microprocessor kit.

APPARATUS REQUIRED:
8086 Microprocessor Kit, Power Chord, Keyboard.

ALGORITHM:
Step1: Get two 16 bit numbers from input memory location.
Step2: Add the two 16 bit numbers.
Step3: Store the result into output memory location.

PROGRAM:

MEMORY MNEMONICS OPCODE COMMENTS


LOCATION
MOVE THE DATA FROM MEMORY TO
1000 MOV AX,[1100H] 8B, 06, 00, 11
ACCUMULATOR (AX REGISTER)
MOVE THE DATA FROM MEMORY TO BX
1004 MOV BX,[1102H] 8B, 1E, 02, 11
REGISTER
1008 SUB AX,BX 29, 08 SUBTRACT THE CONTENT OF BX FROM AX
100A MOV[1200H],AX 89, 06, 00, 12 MOVE THE RESULT FROM AX TO MEMORY
100E HLT F4 STOP THE PROGRAM

FLOWCHART:
6
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

INPUT:

MEMORY GIVEN
LOCATION DATA
1100 H 33 H
1101 H 33 H
1102 H 22 H
1103 H 22 H

OUTPUT:

MEMORY
LOCATION OUTPUT
1200 H 11 H
1201 H 11 H

RESULT:

Thus the Result of Subtraction of Two 16 Bit Numbers Using 8086 Is Executed and Verified Successfully.

7
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO: 1C
MULTIPLICATION OF TWO 16 BIT NUMBERS USING 8086
DATE :
AIM:
Write and execute ALP [Assembly language program] to multiply two 16 bit numbers using
8086 microprocessor.

APPARATUS REQUIRED:
8086 Microprocessor Kit, Power Chord, Keyboard.

ALGORITHM:
Step1: Get two 16 bit numbers from input memory location.
Step2: Multiply the two 16 bit numbers.
Step3: Store the result into output memory location.

PROGRAM:

MEMORY MNEMONICS OPCODE COMMENTS


LOCATION

1000 MOV DX,0000 H C7, C2, 00, 00 CLEAR THE KIT MEMORY.

MOVE THE DATA FROM MEMORY TO


1004 MOV AX,[1100H] 8B, 06, 00, 11
ACCUMULATOR (AX REGISTER).
MOVE THE DATA FROM MEMORY TO BX
1008 MOV BX,[1102H] 8B, 1E, 02, 11
REGISTER.
100C MUL BX F7, F3 MULTIPLY THE CONTENT OF AX FROM BX.
MOVE THE DATA FROM AX TO MEMORY
100E MOV[1200H],AX 89, 06, 00, 12
ADDRESS 1200 H.
MOVE THE DATA FROM DX TO MEMORY
1012 MOV[1201 H],DX 89, 16, 02, 12
ADDRESS 1202 H.
1016 HLT F4 STOP THE PROGRAM.

FLOWCHART: 8
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

INPUT:

MEMORY GIVEN
LOCATION DATA
1100 H 04 H
Multiplicand
1101 H 00 H
1102 H 02 H Multiplier
1103 H 00 H

OUTPUT

MEMORY
LOCATION OUTPUT
1200 H 08 H
1201 H 00 H Pro
1202 H 00 H
1203 H 00 H

RESULT:

Thus the Result of Multiplication of Two 16 Bit Numbers Using 8086 Is Executed and
Verified Successfully.

9
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO: 1D
DIVISION OF TWO 16 BIT NUMBERS USING 8086
DATE :

AIM:
Write and execute ALP [Assembly language program] to divide two 16 bit numbers using
8086 microprocessor .

APPARATUS REQUIRED:
8086 Microprocessor Kit, Power Chord, Keyboard.

ALGORITHM:
Step1: Get two 16 bit numbers from input memory location.
Step2: Divide the two 16 bit numbers.
Step3: Store the result into output memory location.

PROGRAM:

MEMORY MNEMONICS OPCODE COMMENTS


LOCATION

1000 MOV DX,0000 H C7, C2, 00, 00 CLEAR THE KIT MEMORY.

MOVE THE DATA FROM MEMORY TO


1004 MOV AX,[1100H] 8B, 06, 00, 11
ADDRESS (AX REGISTER).
MOVE THE DATA FROM MEMORY ADDRESS
1008 MOV BX,[1102H] 8B, 1E, 02, 11
TO BX REGISTER.
100C DIV BX F7, F3 DIVIDE AX FROM BX.
MOVE THE DATA FROM AX TO MEMORY
100E MOV[1200H],AX 89, 06, 00, 12
ADDRESS 1200 H.
MOVE THE DATA FROM DX TO MEMORY
1012 MOV[1201 H],DX 89, 16, 02, 12
ADDRESS 1202 H.
1016 HLT F4 STOP THE PROGRAM.

FLOWCHART: 10
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

INPUT:

MEMORY GIVEN
LOCATION DATA
1100 H 04 H
Dividend
1101 H 00 H
1102 H 02 H
Divider
1103 H 00 H

OUTPUT:

MEMORY
LOCATION OUTPUT
1200 H 08 H
Quotient
1201 H 00 H
1202 H 00 H Reminder
1203 H 00 H

RESULT:

Thus the Result of division of Two 16 Bit Numbers Using 8086 Is Executed and
Verified Successfully.

11
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO: 1E
LOGICAL OPERATIONS
DATE :

AIM:
To perform logical operations (OR/XOR/AND/NOT) on 16-bit data using 8086 microprocessor.
APPARATUS REQUIRED:
8086 Microprocessor Kit, Power Chord, Keyboard.
ALGORITHM:
1. Set the Source Index address as 2000.
2. Load the data in address of SI to AX.
3. Load the Second data in address of [SI+02] to BX.
4. Perform OR/XOR/AND operation on AX and BX.
5. Perform NOT Operation on AX Register.
6. Move the Content of AX to [SI+04] address.
7. Stop.

PROGRAM:
OR
MEMORY MNEMONICS OPCODE COMMENTS
LOCATION
1000 MOV SI,2000 H C7, C6, 00, 20 INITIALIZE DATA 2000 H TO SI DECLARE
MOVE THE DATA PRESENT IN MEMORY ADDRESS
1004 MOV BX,[SI] 8B, 04
POINT SI TO AX
1006 MOV BX,[SI+2] 8B, 5C, 02 MOVE THE DATA FROM MEMORY LOCATION BX
1009 OR AX,BX 09, D8 LOGICAL OR AX WITH BX
100B MOV [SI+4],AX 89, 44, 04 MOVE DATA FROM AX TO MEMORY LOCATION
100E HLT F4 STOP THE PROGRAM

XOR
MEMORY MNEMONICS OPCODE COMMENTS
LOCATION
1000 MOV SI,2000 H C7, C6, 00, 20 INITIALIZE DATA 2000 H TO SI DECLARE
MOVE THE DATA PRESENT IN MEMORY ADDRESS
1004 MOV AX,[SI] 8B, 04
POINT BY SI TO AX
1006 MOV BX,[SI+2] 8B, 5C, 02 MOVE THE DATA FROM MEMORY LOCATION TO BX
1009 XOR AX,BX 31, D8 LOGICAL XOR AX WITH BX
100B MOV [SI+4],AX 89, 44, 04 MOVE THE DATA FROM AX TO MEMORY LOCATION
100E HLT F4 STOP THE PROGRAM

12
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB
AND
MEMORY MNEMONICS OPCODE COMMENTS
LOCATION
1000 MOV SI,2000 H C7, C6, 00, 20 INITIALIZE DATA 2000 H TO SI
MOVE THE DATA PRESENT IN MEMORY ADDRESS
1004 MOV AX,[SI] 8B, 04
POINT BY SI TO AX
1006 MOV BX,[SI+2] 8B, SC, 02 MOVE THE DATA FROM MEMORY LOCATION TO BX
1009 AND AX,BX 21, D8 LOGICAL AND AX WITH BX
100B MOV [SI+4],AX 89, 44, 04 MOVE THE DATA FROM AX TO MEMORY LOCATION
100E HLT F4 STOP THE PROGRAM

NOT
MEMORY MNEMONICS OPCODE COMMENTS
LOCATION
1000 MOV SI,2000 H C7, C6, 00, 20 INITIALIZE DATA 2000 H TO SI
MOVE THE DATA PRESENT IN MEMORY ADDRESS
1004 MOV AX,[SI] 8B, 04 POINT BY SI TO AX
1006 MOV BX,[SI+2] 8B, 5C, 02 MOVE THE DATA FROM MEMORY LOCATION TO BX
1009 NOT AX,BX F7, D0 LOGICAL NOT AX WITH BX
100B MOV [SI+4],AX 89, 44, 04 MOVE THE DATA FROM AX TO MEMORY LOCATION
100E HLT F4 STOP THE PROGRAM

13
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB
OR XOR
XOR
GIVEN OUTPUT OUTPUT GIVEN
INPUT INPUT ADDRESS DATA INPUT INPUT
OUTPUT OUTPUT
ADDRESS DATA ADDRESS DATA
2004 56 ADDRESS DATA
2000 21 2000 52
2001 85 2004 A4
2001 14 2005 33
2002 12 2002 66 2005 37
2003 52 2003 23

AND
GIVEN OUTPUT OUTPUT
INPUT INPUT ADDRESS DATA
ADDRESS DATA
2004 52
2000 56
2001 7A 14
2005
2002 95
2003 56

NOT
GIVEN OUTPUT OUTPUT
INPUT INPUT ADDRESS DATA
ADDRESS DATA 2004 D9
2000 85
2001 26 2005 7A

14
INPUT DATA
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB
OR

XOR INPUT DATA

AND INPUT DATA

NOT INPUT DATA

RESULT:

Thus the Logical Operation on 16 Bit Data Was Performed

15
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO: 6
MOVING A BLOCK OF DATA
DATE :

AIM:
Write and execute alp (assembly language program) to transfer 10 data memory location 2000 H into
memory location 3000 H

APPARATUS REQUIRED:
8086 Microprocessor Kit, Power Chord, Keyboard.

ALGORITHM:
Step1: Initialize source and destination address location and count.
Step 2: Get the data from source location and move into destination location.
Step3: Increment the source and destination location by 1 and decrement count by 1.
Step4: If count is not equal to zero, then repeat from step 2.
Step5: Stop the program.

PROGRAM:

MEMORY LABEL MNEMONICS OPCODE COMMENTS


LOCATION
INITIALIZE THE DAT 2000 H IN SI
1000 MOV SI, 2000 H C7,C6,00,20
REGISTER
INITIALIZE THE DATA 3000 H IN
1004 MOV DI,3000 H C7,C7,00,30
DI REGISTER
INITAILIZE COUNT 000A H IN CH
1008 MOV CL, 0AH C6,C1,0A
REGISTER
AUTO INCREMENT THE
100B CLD FC
ADDRESS
100C REPEAT MOV SB A4 MOVE THE DATA FROM SI TO DI
DECREMENT COUNT & REPEAT
100D LOOP REPEAT E2,FD
UNTIL COUNT IS 0
100F HLT F4 STOP THE PROGRAM

16
FLOWCHART:
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

OBSERVATION:

INPUT TRANSFER OUTPUT

ADDRESS DATA ADDRESS DATA

2000 H 01 H 3000 H 01 H

2001 H 02 H 3001 H 02 H

2002 H 03 H 3002 H 03 H

2003 H 04 H 3003 H 04 H

2004 H 05 H 3004 H 05 H

2005 H 06 H 3005 H 06 H

2006 H 07 H 3006 H 07 H

2007 H 08 H 3007 H 08 H

2008 H 09 H 3008 H 09 H

2009 H 0A H 3009 H 0A H
BAND ADDRESS=PC NEW –PC OLD

=100A – 100D

=DA-OD=FD

RESULT:

Thus the program to move the 10 data from source to destination was executed and the output is verified.

17
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO: 3A.
DATE : ASCENDING ORDER
AIM:
To write and execute the ALP (assembly language program) for arranging the given data
is an array of ascending order using 8085 microprocessor.
APPARATUS REQUIRED:
8086 microprocessor kit, keyboard, power chord.
ALGORITHM:
Step1: Start the program.
Step2: Initialize the input location in SI register.
Step3: Store the count value in CL register.
Step4: Each time compare, if the carry flag value is input/output.
Step5: Swapping occurs, if the carry flag value is input/output.
Step6: Continues the process till the count value becomes zero.
Step7: By checking the flag value subsequently the array is stored either in descending
& ascending order.
Step8: Stop the program.
PROGRAM:
MEMORY LABEL MNEMONICS OPCODE COMMENTS
LOCATION
1000 MOV CH,05 H C6,C5,05 INITIALIZE EXTERNAL COUNT

1003 DEC CH FE,CD DECREMENT COUNT

1005 REPEAT MOV SI, 2000 H C7,C6,00,20 MOVE DATA 2000 H TO SI

1009 MOV CL, CH 88,E9 MOVE DATA IN CH TO CL

100B BACK MOV AL,[SI] 8A,04 MOVE DATA PRESENT IN MEMORY ADDRESS POINTED BY SI TO AL

100D INC SI 46 INCREMENT SI

100E CMP AL,[SI] 3A,04 COMPARE SI CONTENT WITH AL

1010 JC NEXT 72,08 JUMP ON CARRY, IF CARRY OCCURS GO TO LABEL NEXT

1012 MOV DL,[SI] 8A,14 MOVE DATA PRESENT IN MEMORY LOCATION SI TO DL

1014 MOV [SI],AL 88,04 MOVE AL TO [SI]

1016 DEC SI 4E DECREMENT SI

1017 MOV[SI],DL 88,14 MOVE DL TO MEMORY ADDRESS POINTED BY SI

1019 INC SI 46 INCREMENT SI

101A NEXT DEC CL FE,C9 DECREMENT CL

101C JNZ BACK 75,ED JUMP ON NO ZERO, IF COUNT NOT ‘0’ GO TO BACK

101E DEC CH FE,CD DECREMENT CH

1020 JNZ REPEAT 75,E3 IF COUNT NOT EQUAL TO ‘0’ GO TO LABEL REPEAT

1022 HLT F4 STOP THE PROGRAM.

18
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

FLOWCHART:

INPUT: OUTPUT:

MEMORY GIVEN MEMORY


LOCATION DATA LOCATION OUTPUT
2000 H 05 H 2000 H 01 H
2001 H 04 H 2001 H 02 H
2002 H 03 H 2002 H 03 H
2003 H 02 H 2003 H 04 H
2004 H 01 H 2004 H 05 H

RESULT:
Thus the program for arranging in ascending order was executed and the output was verified.

19
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO: 3A.
DATE : DESCENDING ORDER
AIM:
To write and execute the ALP (assembly language program) for arranging the given data is an array of descending order
using 8085 microprocessor.
APPARATUS REQUIRED:
8086 microprocessor kit, keyboard, power chord.
ALGORITHM:
Step1: Start the program.
Step2: Initialize the input location in SI register.
Step3: Store the count value in CL register.
Step4: Each time compare, if the carry flag value is input/output.
Step5: Swapping occurs, if the carry flag value is input/output.
Step6: Continues the process till the count value becomes zero.
Step7: By checking the flag value subsequently the array is stored in descending order.
Step8: Stop the program.
PROGRAM:
MEMORY LABEL MNEMONICS OPCODE COMMENTS
LOCATION
1000 MOV CH,05 H C6,C5,05 INITIALIZE EXTERNAL COUNT
1003 DEC CH FE,CD DECREMENT COUNT
1005 REPEAT MOV SI, 2000 H C7,C6,00,20 MOVE DATA 2000 H TO SI
1009 MOV CL, CH 88,E9 MOVE DATA IN CH TO CL
BACK MOVE DATA PRESENT IN MEMORY ADDRESS
100B MOV AL,[SI] 8A,04
POINTED BY SI TO AL
100D INC SI 46 INCREMENT SI
100E CMP AL,[SI] 3A,04 COMPARE SI CONTENT WITH AL
JUMP ON CARRY, IF CARRY OCCURS GO TO LABEL
1010 JNC NEXT 73,08
NEXT
MOVE DATA PRESENT IN MEMORY LOCATION SI
1012 MOV DL,[SI] 8A,14
TO DL
1014 MOV [SI],AL 88,04 MOVE AL TO [SI]
1016 DEC SI 4E DECREMENT SI
1017 MOV[SI],DL 88,14 MOVE DL TO MEMORY ADDRESS POINTED BY SI
1019 INC SI 46 INCREMENT SI
101A NEXT DEC CL FE,C9 DECREMENT CL
JUMP ON NO ZERO, IF COUNT NOT ‘0’ GO TO
101C JNZ BACK 75,ED
BACK
101E DEC CH FE,CD DECREMENT CH
IF COUNT NOT EQUAL TO ‘0’ GO TO LABEL
1020 JNZ REPEAT 75,E3
REPEAT
1022 HLT F4 STOP THE PROGRAM.

20
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

FLOWCHART:

INPUT: OUTPUT:

MEMORY GIVEN MEMORY


LOCATION DATA LOCATION OUTPUT
2000 H 05 H 2000 H 01 H
2001 H 04 H 2001 H 02 H
2002 H 03 H 2002 H 03 H
2003 H 02 H 2003 H 04 H
2004 H 01 H 2004 H 05 H

RESULT:
Thus the program for arranging in Descending order was executed and the output was verified.

21
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

PERIPHERALS AND INTERFACING


EXPERIMENTS

22
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO: 4
DATE : TRAFFIC LIGHT CONTROLLER WITH 8086 INTERFACING

AIM:
To interface traffic light with 8086 microprocessor.

APPARATUS REQUIRED:
SL.NO EQUIPMENTS NAME QTY
1 8086 Microprocessor kit 1
2 Traffic Light - Interface board 1
3 Power Chord 2
4 Keyboard 1
5 Bus bar 1
6 CRO 1
7 CRO PROBE 1

ALGORITHM:
There Are Four Way To Control The Traffic In A Four Way Junction As Shown In The Figure.
Here Arrange The Four Lights.

• Red Represents Stop


• Yellow Represents Alert
• Green Represents Proceed
This light signal is placed in the all four direction. Follow on below
• Glow red along west and east
• Glow green along the north and south
• Call delay1 according to traffic
• Glow yellow along the all the four direction
• Call delay 2
• Glow red along north and south
• Glow green along west and east
• Call delay 1
• Yellow along the all direction
• Call delay 2

Algorithms:
Condition 1:
South To North
South To North - Vehicle Can Move From
South To North Straight, South To East Right,South To West Left, East To South Left,
North & West - Red
All Pedestrian Off

Condition 2:
All Pedestrian On
North, South, East & West – RedAll Pedestrian On
23
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

PROGRAM: TRAFFIC LIGHT


MEMORY
LABEL MNEMONICS OPCODE COMMENTS
LOCATION
1000 START MOV AL,80 H C6, C0, 80 Move 80 H to AL

1003 OUT 26H, AL E6,26 OUT AL Take control 26H


1005 REPEAT MOV BX, LOOK UP C7, C3,73,10 Move look up to BX Reg

1009 MOV SI,LABEL C7, C6,7F,10 Move label to source index register

100D CALL OUT E8, 33, 00


1010 MOV AL,[SI] 8A, 04 Move SI to AL

OUT 20H,AL From AL To take OUT the port A


1012 E6, 20
20H
The delay that occurs when a call
1014 CALL DELAY1 E8, 4D, 00 arrives at an automatic switching
device and no channel
1017 INC SI 46 Increment SI

INC BX Increment BX based Register use is


1018 43
to do array operations.
CALL OUT CALL instruction is used to call the
1019 E8, 27, 00
subroutine
101C MOV AL,[SI] 8A, 04 Move SI to AL

OUT 22H,AL From AL To take OUT the port B


101E E6, 22
22H
The delay that occurs when a call
1020 CALL DELAY1 E8, 41, 00 arrives at an automatic switching
device and no channel
1023 INC SI 46 Increment SI

INC BX Increment BX based Register use is


1024 43
to do array operations.
CALL OUT CALL instruction is used to call the
1025 E8, 1B, 00
subroutine
1028 MOV AL,[SI] 8A, 04 Move SI to AL

OUT 24H,AL From AL To take OUT the port C


102A E6, 24
24H
The delay that occurs when a call
102C CALL DELAY1 E8, 35, 00 arrives at an automatic switching
device and no channel
102F INC SI 46 Increment SI

INC BX Increment BX based Register use is


1030 43
to do array operations.

24
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

PROGRAM (TRAFFIC LIGHT) CONTD 1…


MEMORY
LABEL MNEMONICS OPCODE COMMENTS
LOCATION
CALL OUT CALL instruction is used to call the
1031 E8, 0F, 00
subroutine
1034 MOV AL,[SI] 8A, 04 Move SI to AL

OUT 24H,AL From AL To take OUT the port C


1036 E6, 24
24H
1038 INC SI 46 Increment SI

1039 MOV AL,[SI] 8A, 04 Move SI to AL

OUT 20H,AL From AL To take OUT the port A


103B E6, 20
20H
The delay that occurs when a call
103D CALL DELAY1 E8,24, 00 arrives at an automatic switching
device and no channel
JMP REPEAT Its performs an unconditional jump .
1040 E9, C2, FF
it used instruct the repeat task
1043 OUT MOV AL,[BX] 8A, 07 Move BX based Register to AL

OUT 24H,AL From AL To take OUT the port C


1045 E6, 24
24H
INC BX Increment BX based Register use is
1047 43
to do array operations
1048 MOV AL,[BX] 8A, 07 Move BX based Register to AL

OUT 22H,AL From AL To take OUT the port B


104A E6, 22
22H
INC BX Increment BX based Register use is
104C 43
to do array operations
104D MOV AL,[BX] 8A, 07 Move BX based Register to AL

OUT 20H,AL From AL To take OUT the port A


104F E6, 20
20H
The delay that occurs when a call
1051 CALL DELAY E8, 01, 00 arrives at an automatic switching
device and no channel
RET This instruction is stand for return. It
1054 C3
is used at the end of the procedures
DELAY Move 0040 H Data address to
MOV DI,0040 H designation index. The DI
1055 C7, C7, 40, 00
instruction stands for “Disable
Interrupts”. It is a 1-Byte instruction.
1059 A MOV DX,0FFFF H C7, C2, FF FF Move 0FFFF H Data address to DX

25
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

PROGRAM (TRAFFIC LIGHT) CONTD 2….


MEMORY
LABEL MNEMONICS OPCODE COMMENTS
LOCATION
105D A1 DEC DX 4A Decrement Dx
The JNZ instruction transfers control
105E JNZ A1 75, FD to the specified address if the value
in the accumulator is not 0.
Decrement The DI instruction stands
1060 DEC DI 4F for “Disable Interrupts”. It is a 1-
Byte instruction
1061 JNZ A 75, F6 No zero jumped to A

RET This instruction is stand for return. It


1063 C3
is used at the end of the procedures
DELAY1 MOV DI,0015 H Move 0015 H Data address to
1064 C7, C7, 15, 00
designation index.
B Move 0FFFF H Data address to DX
1068 MOV DX,0FFFF H C7, C2, FF FF Data reg. it is used multiplication i/o
port address
106C B1 DEC DX 4A Decrement The Dx data reg
106D JNZ B1 75 FD No zero jumped to B1
Decrement The DI instruction stands
106F DEC DI 4F for “Disable Interrupts”. It is a 1-
Byte instruction
1070 JNZ B 75, F6 No zero jumped to B

RET This instruction is stand for return. It


1072 C3
is used at the end of the procedures.

OBSERVATION:
INPUT
DB 1073: 12H, 27H, 44H, 10H LOOK UP
1077: 2BH, 92H, 10H, 9DH
107B: 84H, 48H, 2EH, 84H

107F:48H, 4BH, 20H, 49H LABEL


1083: 04H
107D: END

ORG 1000
CNTRL EQU 26H
PORTA EQU 20H
PORTB EQU 22H
PORTC EQU 24H

26
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

TRAFFIC LIGHT OUTPUT:

RESULT:
Thus The Interface of Traffic light controller was studied and connected with 8086 Microprocessor
Using by interfacing cable is got Output Is Verified.

27
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO:
STEPPER MOTOR INTERFACING WITH 8086
DATE :

AIM:

To interface a stepper motor with 8086 microcontroller and to controller the speed of the motor.

APPARATUS REQUIRED:

8086 Microprocessor Kit, Power Chord, Keyboard, Stepper motor Interface Board, Bus bar,
Stepper Motor

SQUARE ROOT:
ALGORITHM:

1. Initialize the input memory location and pulse count.


2. Get the data from input memory location and send to the output port address.
3. Apply the delay.
4. Decrement the pulse count.
5. If pulse count is not zero, repeat step2 and step1 for continuous rotation.

ALGORITHM:
1. Fix the DPTR with the Latch Chip address FFC0
2. Move the values of register A one by one with some delay based on the 2-Phase switching Scheme
and repeat the loop.
3. For Anti Clockwise direction repeat the step 3 by reversing the valuesequence.
4. End the Program

PROGRAM:

MEMORY
LABEL MNEMONICS OPCODE COMMENTS
LOCATION
1000 Start MOV DI, TABLE C7, C7, 18,10 Move code address to DI
1004 MOV CL, 04 H C6, C1, 04 Declare the count.
1007 Back MOV AL, [DI] 8A, 05 Move DI data into AL
1009 OUT 0C0, AL E6, C0 Out AL to C0.
100B MOV DX, 1010 H C7, C2, 10, 10 Move 1010 H to DX Register
100F Delay DEC DX 4A Decrement the DX
1010 JNZ DELAY 75, FD Jump to delay label
1012 INC DI 47 When C=0 Increment the DI
1013 LOOP BACK E2, F2 Go to back label
1015 JMP START E9, E8, FF Jump to start label
Table This input given in 8086 kit use
1018 SB : 09, 05, 06, 0A Data bytes SB For Stepper Motor Rotate
Clock Wise Direction
Table This input given in 8086 kit use
1018 SB : 0A, 06, 05, 09 Data bytes SB For Stepper Motor Rotate Anti
Clock Wise Direction

28
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

FLOW CHART:

OBSERVATION:

INPUT: CLOCKWISE INPUT: ANTI CLOCKWISE

09 05 06 0A 0A 06 05 09

29
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

RESULT:
Thus stepper motor is interfaced and its speed is controlled using 8086 microprocessor

EX NO:
8279 INTERFACING WITH 8086-DISPLAY THE CHARACTER
DATE :
AIM:
To display the rolling message in the display.
APPARATUS REQUIRED:
1.8086 Microprocessor kit
2. 8279- Interface board

Connections:
1. Connect EN/U8 tag to ground tag to enable U8 decoder.
2. Connect EN/DSP tag to 8th output tag of the U8 decoder.

PROGRAM:
MEMORY
LABEL MNEMONICS OPCODE COMMENTS
LOCATION
1000 MOV AL,00 H C6, C0, 00 Move 00H To AL
1003 OUT CNT,AL E6, C2 Move AL To C2
1005 MOV AL,0CC C6, C0,CC Move DL To AL
1008 OUT CNT,AL E6, C2 Out AL Data To C2
100A MOV AL,90 H C6, C0, 90 Move 90H To AL
100D OUT CNT,AL E6, C2 Out AL into C2
100F MOV AL,88 H C6, C0, 88 Move 88H To AL
1012 OUT DAT,AL E6, C0 Out AL into Data
1014 MOV AL,FF H C6, C0, FF Move FF Into AL
1017 MOV CL,05 H C6, C1, 05 Move 05H To CL
101A BACK OUT DAT,AL E6,C0 Out From AL To DAT
101C LOOP BACK E2, FC Loop Execution
101E HLT F4 Stop The Program
30
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

FLOW CHART

PIN CONFIGURATION:

CONTROL WORD OF 8279

KEYBOARD / DISPLAY MODE


0 0 0 0 0 0 0 0
0 0 0 D D K K K

CONTROL DISPLAY KEYBOARD


WORD MODE SET MODE SET

DD 00 = 8-bit character Digit- left entry


KKK 000 = Encoded scan -2key lock out

CNT= Type in kit C2 instead for CNT


DAT=Type in kit C0 instead for DAT
CLEAR DISPLAY MODE

31
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

1 1 0 0 1 1 0 0

CD2-CD CD0-Hex Value EC


RAM

WRITE MODE
RAM

AI A A A A
0 0 0 D D K K K

0 0 0 D D K K K
TO DISPLAY A

CLEAR DISPLAY

CD2 CD1 CD0

1 0 X
1 1 0
1 1 1

INPUT

OUTPUT

INPUT

DISPLAY SEGMENTS

32
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

DISPL dp g f e d c b a
AY HEX
VALUE
(input)
0 1 1 0 0 0 0 0 0 C0
1 1 1 1 1 1 0 0 1 F9
2 1 0 1 0 0 1 0 0 A4
3 1 0 1 1 0 0 0 0 B0
4 1 0 0 1 1 0 0 1 99
5 1 0 0 1 0 0 1 0 92
6 1 0 0 0 0 0 1 0 82
7 1 1 0 1 1 0 0 0 D8
8 1 0 0 0 0 0 0 0 80
9 1 0 0 1 0 0 0 0 90

33
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

RESULT:

Thus the Program for Displaying the Required Character with Keyboard Interface Is Executed
and Verified.

EX NO: 6
SERIAL COMMUNICATION INTERFACE USING 8086
DATE :
AIM:
To establish serial communication between two MP kits using 8251.
APPARATUS REQUIRED:
1. 8086 Microprocessor tool kit.
2. RS 232C cable.
3. 8251 Interface board
ALGORITHM:
1. Initialize 8086 and 8251 to check the Transmission and Reception of aCharacter.
2. Initialize 8086 to give an output.
3. The command word and mode word is written to the 8251 for subsequentoperations.
4. The status word is read from the 8251 on completion of a serial I/O operation, or when the host
CPU is checking the status of the device beforestarting the next operation.
5. Stop the program.

PROGRAM: Transmitter End

MEMORY
LABEL MNEMONICS OPCODE COMMENTS
LOCATION
1000 MOV AL,36 B0, 36 Move 36 to AL
1002 OUT CE,AL E6, CE From AL take OUT Port CE
1004 MOV AL,10 B0, 10 Move 10 to AL
1006 OUT C8,AL E6, C8 From AL take OUT Port C8
1008 MOV AL,00 B0, 00 Move 00 to AL
100A OUT C8,AL E6, C8 From AL take OUT Port C8
100C MOV AL,4E B0, 4E Move 4E to AL
100E OUT C2,AL E6, C2 From AL take OUT Port C2
1010 MOV AL,37 B0, 37 Move 37 to AL
1012 OUT C2,AL E6, C2 From AL take OUT Port C2

34
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

1014 LOOP1 IN AL,C2 E4, C2 C2 TO AL


1016 AND AL,04 24, 04 Data 02 Used Logic AND to AL
1018 JZ LOOP1 74, FA JZ (jump 0) used loop
101A MOV AL,41 B0, 41 Move 41 to AL
101C OUT C0,AL E6, C0 From AL take OUT Port C0
101E INT 2 CD, 02 This format INT type, where the
type ranges from 00 to FF. These
are 2-byte instructions.

Serial Communication Interface Using 8086


PROGRAM: Receiver End

MEMORY
LABEL MNEMONICS OPCODE COMMENTS
LOCATION
1200 MOV AL,36 B0, 36 Move 36 to AL
1202 OUT CE,AL E6, CE From AL take OUT Port CE
1204 MOV AL,10 B0, 10 Move 10 to AL
1206 OUT C8,AL E6, C8 From AL take OUT Port C8
1208 MOV AL,00 B0, 00 Move 00 to AL
120A OUT C8,AL E6, C8 From AL take OUT Port C8
120C MOV AL,4E B0, 4E Move 4E to AL
120E OUT C2,AL E6, C2 From AL take OUT Port C2
1210 MOV AL,37 B0, 37 Move 37 to AL
1212 OUT C2,AL E6, C2 From AL take OUT Port C2
1214 LOOP2 IN AL,C2 E4, C2 C2 TO AL
1216 AND AL,02 24, 02 Data 02 Used Logic AND to AL
1218 JZ LOOP2 74, FA JZ (jump 0) used loop
121A IN AL,C0 E4, C0 C0 TO AL
121C MOV BX,1500 BB, 00, 15 Move 1500 to BX based reg
121F MOV[BX],AL 88, 07 Move AL to BX Data ptr used for
based reg
1221 INT 2 CD, 02 This format INT type, where the
type ranges from 00 to FF. These
are 2-byte instructions

35
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

RESULT:

Thus The Interface of serial port communication was studied and connected with 8086 Microprocessor
Using by interfacing cable is got Output Is Verified.

EXP NO:
PARALLEL INTERFACE USING 8255 PPI WITH 8086
DATE MICROPROCESSOR
AIM:
To connect two 8086 microprocessor kits and to establish parallel communication with each other by
considering transmitter and receiver kits.
APPARATUS REQUIRED:
1.8086 Microprocessor kit
2. 8255- Interface board
3. Power Chord
4. Keyboard
5. Bus bar

THEORY:
• 8255 is a general purpose programmable device used for data transfer
Between processor and I/O devices.
• It has 3 programmable I/O ports (PA,PB &PC) and port operation (IN/OUT Port)
is defined by control word in the control word register.
• Ports are operated in two modes:
i) I/O modes: Mode 0, Mode 1,& Mode 2
ii) BSR (Bit set/Reset) mode
About 8255
• PPI has 40 pins and it has three distinct modes of operation.
• Port A (PA7-PA0) :8 pins
• Port B (PB7-PB0):8 pins
• Port C (Pc: Upper: PC7-PC4): 4 pins
• Port C (Pc: Lower: PC3-PC0): 4 pins
• Data Bus (D7-D0): 8 pins
• Control signals: 6 pins
• VCC and Gnd: 2 pins
36
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

PIN DIAGRAM:

PIN NAMES AND FUNCTION

PIN N.O OF I/O FUNCTIONS


NAME PINS
PA0-PA7 8 I/O • Port can be configured either input or output by
Tristate software
PB0-PB7 8 I/O • Port has output latch buffer and input buffer.
Tristate • PA Can be programmed by mode0, mod 1, mode 2.

PC0-PC7 8 I/O • PB can be programmed by mode 0 and mode 1.


Tristate • PC can be programmed by bit set/reset operation.
• Port C can be divided into two 4 bits ports namely
PC7-PC4 & PC3-PC0 and user for control signals
to PA and PB.

D0-D7 8 I/O • Used for data transfer with MPU


Tristate • Transfer of control words to PPI
• Read status information from PPI.

PROCEDURE:

1. To take 8086 microprocessor kit


2. Enter the transmitter program in transmitter kit
3. Enter the receiver program in receiver kit
4. Interface the two kit with 26 –core on PPT-I
5. Execute the receiver kit
6. Go and see the memory location 1200 in to set same eight data.
7. Data is available in transmitter bit in memory location.
8. Change the data and execute the following procedure and get the result in receiver kit.

37
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

FLOWCHART:

PROGRAM:
MEMORY
LABEL MNEMONICS OPCODE COMMENTS
LOCATION
1000 MOV AL, 90 H C6, C0, 90 Move 90 H to AL
1003 OUT C6, AL E6, C6 Move AL to C6
1005 IN AL,C0 E4, C0 Move data C0 to AL
1007 OUT C2, AL E6, C2 Out AL data to C2
1009 HLT F4 Stop the program

38
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

INPUT:

PORT A SWITCH
0 0 0 0 1 1 0 0 1-SWITCH ON
0-SWITCH OFF
OUTPUT:

PORT B LED
OFF OFF OFF OFF ON ON OFF OFF 1-LED ON
0-LED OFF

CONTROL WORD:

RESULT:
Thus the Parallel Communication between Two 8086 Microprocessors Kit Has Been
Established and the data is Transmitted in one Kit and Received in the other kit
Successfully.

39
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

EXP NO:
ADC USING 8255 PORTS WITH 8086
DATE MICROPROCESSOR

AIM:
To interface ADC with 8086 using 8255 ports
APPARATUS REQUIRED:
1.8086 Microprocessor kit
2ADC- Interface board
3. Power Chord
4. Keyboard
5. Bus bar
ALGORITHM:
• Initialize 8255
• Select Input 2 As Analog
• Give Start To Conversion
• Check For Edc And Read The Digital Equipment
• End The Program.
PROGRAM:
MEMORY
LABEL MNEMONICS OPCODE COMMENTS
LOCATION
1000 MOV AL,10 H C6, C0, 10 Move 10 H to AL
1003 OUT C8, AL E6, C8 Data AL to C8
1005 MOV AL, 18H C6, C0, 18 Move data 18 to AL
1008 OUT C8,AL E6, C8 Out AL data to C8
100A HLT F4 Stop the program

40
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

FLOWCHART:

OBSERVATION:

INPUT

ANALOG INPUT= 0 V ANALOG INPUT= 5 V

OUTPUT

LED OUTPUT FOR 0 V

0 0 0 0 0 0 0 0

0-LOW OFF

LED OUTPUT FOR 5 V

1 1 1 1 1 1 1 1
1 -HIGH ON

RESULT:
Thus a program to interface ADC using 8086 is written and executed.

41
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

EXP NO:
INTERFACING DAC USING 8086 AND GENERATE
DATE TRIANGULAR WAVEFORM

AIM:
To interface DAC using 8086 microprocessor kit and generate a triangular wave.

APPARATUS REQUIRED:

SL.NO EQUIPMENTS NAME QTY


1 8086 Microprocessor kit 1
2 DAC- Interface board 1
3 Power Chord 2
4 Keyboard 1
5 Bus bar 1
6 CRO 1
7 CRO PROBE 1
8 Graph sheet 1

C) TO GENERATE TRIANGULAR WAVE


ALGORITHM:

Step 1: Store Low Digital Value in Acc. (00)


Step 2: Output it to LATCH
Step 3: Increase the Accumulator by 1
Step 4: Output it to LATCH
Step 5: Repeat Steps 3 to 5 till value reaches ‘FF’
Step 6: Decrease the Accumulator by 1
Step 7: Output it to LATCH
Step 8: Repeat Steps 6 to 8 till value reaches ‘00’
Step 9: Observe waveform on CRO

ALGORITHM:
1. Initialize using 8255 ports
2. Start using lamp from 0V by sending 00H to DAC.
3. Increment lamp till 5V
4. Output it & start the falling lamp by decrementing the counter till it reaches zero.
5. End the program.

42
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

PROGRAM:
MEMORY
LABEL MNEMONICS OPCODE COMMENTS
LOCATION
1000 REPEAT MOV AL, 00 C6, C0, 00 Move 00 to AL
1003 BACK OUT C0, AL E6, C0 Out AL data to C0
1005 INC AL FE, C0 Increment AL
1007 JNZ BACK 75, FA If non-zero go back
1009 JMP REPEAT E9, F4, FF Jump to repeat
100C HLT F4 Stop the program

FLOWCHART:

OUTPUT:
AMPLITUDE(V) TIME PERIOD (µS)
1.6 x 2 = 3.2 V 1.2 x 0.5 = 0.6 µS
TRIANGULAR WAVE:

RESULT:
Thus a program to interface ADC Using 8086 Is Written & Executed the Triangular
waveform.

43
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

8086/8051 EXPERIMENTS USING KITS/MASM

44
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO:
8 BIT ADDITION USING 8051
DATE :

AIM:
To write and execute the assembly language program to add the two 8 bit numbers using
8051 microcontroller.

APPARATUS REQUIRED:
8051 Microcontroller kit, Power chord, Keyboard.

ALGORITHM:
(WITHOUT CARRY)
1. Get the input data and store it in accumulator.
2. Add the content with another input data.
3. Store the result in required memory location using DPTR.
4. Move accumulator content to DPTR.
5. Stop the program using SJMP.
(WITH CARRY)
1. Start the program by loading the first data into accumulator.
2. Move the data to A register.
3. Get the 2nd data and load into accumulator.
4. Add the two contents and check for carry.
5. Store the value of sum and carry in the memory location.
6. Stop the program.

45
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

PROGRAM:
WITHOUT CARRY
MEMORY LABEL MNEMONICS OPCODE COMMENTS
LOCATION
4100 MOV A,#04 H 74,04 MOVE DATA 04 H TO A
4102 ADD A,#02 H 24,02 ADD 01 H DATA WITH A
4104 MOV DPTR,#4700 H 90,47,00 MOVE 4700 H TO DPTR
4107 MOVX @DPTR,A F0 MOVE A TO DPTR
4108 STOP SJMP STOP 80,FE STOP THE PROGRAM USING SJMP

WITH CARRY
MEMORY LABEL MNEMONICS OPCODE COMMENTS
LOCATION
4100 MOV DPTR, # 4500 H 90,45,00 MOVE 4500 H TO DPTR
4103 MOV R1, # 00 H 79,00 MOVE 00H TO R1
4105 MOVX A,@DPTR E0 MOV DPTRTO A
4016 MOV R0,A F8 MOVE A TO R0 REGISTER
4017 INC DPTR A3 INCREMENT DPTR
4108 MOVX A,@DPTR E0 MOV DPTR TO A
4109 ADDC A,R0 38 ADD WITH CARRY R0 AND A
410A JNC NEXT 50,00 JUMP TO LABEL NEXT TO CR=0
410C NEXT INC R1 09 INCREMENT R1
410D MOV DPTR,# 4700 H 90,47,00 MOVE 4700 TO DPTR
4110 MOVX @DPTR,A F0 MOV A TO DPTR
4111 MOV A,R1 E9 MOV R1 TO A
4112 INC DPTR A3 INCREMENT DPTR
4113 MOVX @DPTR,A F0 MOVE A TO DPTR
4114 STOP SJMP STOP 80,FE STOP THE PROGRAM

FLOWCHART:
WITHOUT CARRY WITH CARRY

46
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

OBSERVATION (WITHOUT CARRY)


INPUT: OUTPUT:
ADDRESS GIVEN ADDRESS OUTPUT
DATA DATA
4101 H 02 H 4700 H 06 H
4103 H 04 H

WITH CARRY
INPUT OUTPUT

ADDRESS GIVEN ADDRESS GIVEN


DATA DATA
4500 H F0 H 4700 H E0 H
4501 H F0 H 4701 H 01 H

RESULT:
Thus the program for addition of two 8 bit numbers using 8051 microcontroller
was executed and the output was verified.

47
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO:
8 BIT SUBTRACTION USING 8051
DATE :
AIM:
To write and execute the assembly language program to the subtraction of two 8 bit
numbers using 8051 microcontroller.

APPARATUS REQUIRED:
8051 Microcontroller kit, Power cord, Keyboard.

ALGORITHM:
(WITHOUT BARROW)
1. Get the input data and store it in accumulator.
2. Subtract the accumulator content with another input data.
3. Store the result in required memory location using DPTR.
4. Move the accumulator content to DPTR.
5. Stop the program using SJMP.
(WITH BARROW)
1. Start the program by loading the first data into accumulator.
2. Move the data to A register.
3. Get the 2nd data and load into accumulator.
4. Subtract the two register contents and check the borrow.
5. If borrow is present then take the 2’s complement of accumulator content.
6. Store the value of Difference and Borrow in the memory location.
7. Stop the program using SJMP.

PROGRAM:
WITHOUT BORROW
MEMORY LABEL MNEMONICS OPCODE COMMENTS
LOCATION
4100 MOV A,#04 H 74,04 MOVE DATA 04 H TO A
4102 SUBB A,#02 H 94,02 SUBTRACT 02 H FROM A
4104 MOV DPTR,#4700 H 90,47,00 MOVE 4700 H TO DPTR
4107 MOVX @DPTR,A F0 MOVE A TO DPTR
4108 STOP SJMP STOP 80,FE STOP THE PROGRAM USING SJMP

WITH BORROW

48
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

MEMORY LABEL MNEMONICS OPCODE COMMENTS


LOCATION
4100 MOV DPTR, # 4500 H 90,45,00 MOVE 4500 H TO DPTR
4103 MOV R1, # 00 H 79,00 MOVE 00H TO R1
4105 MOVX A,@DPTR E0 MOV DPTRTO A
4016 MOV R0,A F8 MOVE A TO R0 REGISTER
4017 INC DPTR A3 INCREMENT DPTR
4108 MOVX A,@DPTR E0 MOV DPTR TO A
4109 SUBB A,R0 98 SUBTRACT WITH BORROW R0 & A
410A JNC NEXT 50,01 JUMP TO LABEL NEXT TO CR=0
410C NEXT INC R1 09 INCREMENT R1
410D MOV DPTR,# 4700 H 90,47,00 MOVE 4700 TO DPTR
4110 MOVX @DPTR,A F0 MOV A TO DPTR
4111 MOV A,R1 E9 MOV R1 TO A
4112 INC DPTR A3 INCREMENT DPTR
4113 MOVX @DPTR,A F0 MOVE A TO DPTR
4114 STOP SJMP STOP 80,FE STOP THE PROGRAM

FLOWCHART:
WITH OUT BORROW
WITH BORROW

49
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

OBSERVATION:
WITHOUT BORROW

INPUT: OUTPUT:
ADDRESS GIVEN ADDRESS OUTPUT
DATA DATA
4101 H 04 H 4700 H 02 H
4103 H 02 H

WITH BORROW
INPUT OUTPUT

ADDRESS GIVEN ADDRESS GIVEN


DATA DATA
4500 H 5B H 4700 H 3F H
4501 H 1C H 4701 H 00 H

ADDRESS GIVEN
ADDRESS GIVEN DATA
DATA 4700 H FE H
4500 H 02 H 4701 H 01 H
4501 H 04 H

RESULT:
Thus the program for Subtraction of two 8 bit numbers using 8051 microcontroller
was executed and the output was verified.

50
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO:
8 BIT MULTIPLICATION USING 8051
DATE :

AIM:

To write and execute an assembly language program for multiply the two 8 bit numbers
using 8051 microcontroller.
APPARATUS REQUIRED:

8051 Microcontroller kit, Power cord, Keyboard.

ALGORITHM:
(WITHOUT CARRY)
1. Store the 1st input data in A-register & 2nd input data in B-register.
2. Multiply the A&B register content using MUL.
3. Initialize DPTR.
4. Move (or) access external memory to DPTR.
5. Increment DPTR & Store the result.
6. Stop the program using SJMP.

PROGRAM:
MEMORY LABEL MNEMONICS OPCODE COMMENTS
LOCATION
4100 MOV A,#04 H 74,04 MOVE 04 H TO A
4102 MOV B,#02 H 75,02,F0 MOVE 02 H TO B
4105 MUL AB A4 MULTIPLY A&B
4106 MOV DPTR,#4700 H 90,47,00 MOVE 4700 H TO DPTR
4109 MOVX @DPTR,A F0 MOVE A TO DPTR
410A INC DPTR A3 INCREMENT DPTR
410B MOV A,B E5,F0 MOVE B REG GO TO A REG
410D MOVX @DPTR,A F0 MOVE A TO DPTR
410E STOP SJMP STOP 80,FE STOP THE PROGRAM

51
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

FLOWCHART:

OBSERVATION:

INPUT: OUTPUT:
ADDRESS GIVEN ADDRESS OUTPUT
DATA DATA
4101 H 04 H 4700 H 08 H
4104 H 02 H 4701 H 00 H

RESULT:
Thus the program for multiplication of two 8-bit numbers using
8051 microprocessors was executed and the result was verified.

52
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO:
8 BIT DIVISION USING 8051
DATE :
AIM :
To write and execute an assembly language program to divide the two 8-bit
numbers using 8051 microcontroller.

APPARATUS REQUIRED:
8051 Microcontroller Kit, Power Chord, Keyboard.

ALGORITHM:
1.Get the two 8-bit data as input, store one 8-bit data in A register & other to
B-register.
2.Divide the A register content with b-register content.
3. store the result, that is quotient and remainder in required to memory
location using DPTR.
4. Stop the program using SJMP.

PROGRAM:
MEMORY LABEL MNEMONICS OPCODE COMMENTS
LOCATION
4100 MOV A,#04 H 74, 04 Move 04 H To A Register
4102 MOV B,#02 H 75, 02, F0 Move 02 H To B Register
4105 DIV AB 84 Divide A And B
4106 MOV DPTR,#4700 H 90, 47, 00 Initialize DPTR
4109 MOVX @DPTR,A F0 Move A To DPTR
410A INC DPTR A3 Increment DPTR
410B MOV A,B E5, F0 Move B To A
410C MOVX @DPTR,A F0 Move A To DPTR
410E STOP SJMP STOP 80, FE Stop The Program Using SJMP

53
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

FLOWCHART:

OBSERVATION:

INPUT: OUTPUT:
ADDRESS GIVEN ADDRESS OUTPUT
DATA DATA
4101 H 04 H 4700 H 02H
4104 H 02 H 4701 H 00 H

RESULT:
Thus the program for division of two 8-bit numbers using 8051
microprocessors was executed and the result was verified.

54
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO:
LOGICAL OPERATION XOR USING 8051
DATE :

AIM:
To write & execute and ALP for performing logical operation XOR using
8051 microcontroller.

APPARATUS REQUIRED:
8051 Microcontroller Kit, Power Chord, Keyboard.

ALGORITHM:
1. Start the program
2. Load the data to accumulator.
3. Perform the logical XOR operation with that data.
4. Store the result into output memory location.
5. Stop the program.

PROGRAM:

MEMORY
LABE
LOCATIO MNEMONICS OPCODE COMMENTS
L
N
4100 MOV DPTR, #4500 90, 45, 00 Move 4500 To DPTR
4103 MOVX A,@DPTR E0 Move DPTR To A
4104 MOV R0,A F8 Move A To R0
4105 XRL A, R0 68 Logically XOR if R0 With A
4106 INC DPTR A3 Increment DPTR
4107 MOVX @DPTR,A F0 Move A To DPTR
4108 STOP SJMP STOP 80 Stop The Program Using SJMP

55
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

FLOW CHART:

OBSERVATION:

INPUT: OUTPUT:
ADDRESS GIVEN ADDRESS OUTPUT
DATA DATA
4500 H 78 H 4501 H 00 H

RESULT:
Thus the program to perform Logical Xor Using 8051 Was
Executed And The Output Was Verified.

56
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO:
MOVE A DATA BLOCK WITHOUT OVERLAP
DATE :

AIM:

To move a block of data from Address Location1500 to Address Location 1600 using 8051

APPARATUS REQUIED :

8051 Microprocessor Kit.

ALGORITHM:
Step1: Initialize source and destination address location and count.
Step 2: Get the data from source location and move into destination location.
Step3: Increment the source and destination location by 1 and decrement count by 1.
Step4: If count is not equal to zero, then repeat from step 2.
Step5: Stop the program.
PROGRAM:
MOV R0,#1400H;
MOV R1,#1500H;
MOV R2,#1600H;
REPEAT:MOV A,@R0;
MOV @R1,A;
INC R0;
INC R1;
DJNZ R2,REPEAT;
STOP: SJMP STOP;
END;

OBSERVATION:
INPUT DATA OUTPUT
1400-01 1600-01
1500-02 1601-02
1501-03 1602-03
1502-04 1603-04

RESULT:
Thus the moving block of data from 1500 to 1600 using 8051 was pereformed.

57
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO:
ASENDING ORDER
DATE :

AIM:

To arrange an array of 8bit unsigned numbers of known length in an asending order.

APPARATUS REQUIRED:

8051 Microcontroller Kit, Power chord,Key board.

ALGORITHM:
Step1: Start the program.
Step2: Initialize the input location in SI register.
Step3: Store the count value in CL register.
Step4: Each time compare, if the carry flag value is input/output.
Step5: Swapping occurs, if the carry flag value is input/output.
Step6: Continues the process till the count value becomes zero.
Step7: By checking the flag value subsequently the array is stored either in descending
& ascending order.
Step8: Stop the program

58
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

PROGRAM:
MEMORY LABEL MNEMONICS OPCODE COMMENTS
LOCATION
4100 MOV R3,#4 7B 04

4102 MOV R4,#4 7C 04

4104 MOV DPTR,#4500 90 45 00


4107 REPT:1 MOV R5,DPL AD 82
4109 MOV R6, DPH AE 83
410B MOVX A,@DPTR E0
410C MOV B,A F5 FO
410E REPT INC DPTR A3
410F MOVX A,@DPTR E0
4110 MOV R0,A F8
4111 CLR C C3
4112 SUBB A,B 95 F0
4114 JNC CHKNXT 50 13
4116 EXCH PUSH DPL C0 82
4118 PUSH DPH C0 83
411A MOV DPL,R5 8D 82
411C MOV DPH,R6 8E 83
411E MOV A,R0 E8
411F MOVX @DPTR,A F0
4120 POP DPH D0 83
4122 POP DPL D0 82
4124 MOV A,B E5 F0
4126 MOVX @DPTR,A F0
4127 MOV B,R0 88 F0
4129 CHKNXT: DJNZ R3,REPT DBE3
412B DEC R4 1C
412C MOV A,R4 EC
412D MOV R3,A FB
412E INC R 4 OC
412F MOV DPL,R5 8D 82
4131 MOV DPH,R6 8E 83
4133 INC DPTR A3
4134 DJNZ R4,REPT1 DC D1
4136 SJMP HLT 80 FE

59
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

INPUT:

ADDRESS GIVEN
DATA

OUTPUT:

ADDRESS GIVEN
DATA

RESULT:
Thus the assembly language program was written to sort the data in an ascending order and
executed using 8051 microcontroller.

60
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO:
DESENDING ORDER
DATE :

AIM:

To arrange an array of 8bit unsigned numbers of known length in an desending order.

APPARATUS REQUIRED:

8051 Microcontroller Kit, Power chord,Key board.

ALGORITHM:
Step1: Start the program.
Step2: Initialize the input location in SI register.
Step3: Store the count value in CL register.
Step4: Each time compare, if the carry flag value is input/output.
Step5: Swapping occurs, if the carry flag value is input/output.
Step6: Continues the process till the count value becomes zero.
Step7: By checking the flag value subsequently the array is stored either in descending
& ascending order.
Step8: Stop the program

Program:

61
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

MEMORY LABEL MNEMONICS OPCODE COMMENTS


LOCATION
4100 MOV R3,#4 7B 04

4102 MOV R4,#4 7C 04

4104 MOV DPTR,#4500 90 45 00


4107 REPT:1 MOV R5,DPL AD 82
4109 MOV R6, DPH AE 83
410B MOVX A,@DPTR E0
410C MOV B,A F5 FO
410E REPT INC DPTR A3
410F MOVX A,@DPTR E0
4110 MOV R0,A F8
4111 CLR C C3
4112 SUBB A,B 95 F0
4114 JNC CHKNXT 50 13
4116 EXCH PUSH DPL C0 82
4118 PUSH DPH C0 83
411A MOV DPL,R5 8D 82
411C MOV DPH,R6 8E 83
411E MOV A,R0 E8
411F MOVX @DPTR,A F0
4120 POP DPH D0 83
4122 POP DPL D0 82
4124 MOV A,B E5 F0
4126 MOVX @DPTR,A F0
4127 MOV B,R0 88 F0
4129 CHKNXT: DJNZ R3,REPT DBE3
412B DEC R4 1C
412C MOV A,R4 EC
412D MOV R3,A FB
412E INC R 4 OC
412F MOV DPL,R5 8D 82
4131 MOV DPH,R6 8E 83
4133 INC DPTR A3
4134 DJNZ R4,REPT1 DC D1
4136 SJMP HLT 80 FE

62
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

INPUT:

ADDRESS GIVEN
DATA

OUTPUT:

ADDRESS GIVEN
DATA

RESULT:
Thus the assembly language program was written to sort the data in an desending order and
executed using 8051 microcontroller.

63
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

8086/8051 program using kits/masm

EX NO:

64
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

DATE : CONVERT DECIMAL TO HEXA DECIMAL


AIM:
To write ALP (assembly language program) to convert a given decimal number is hexadecimal
number using 8086 microprocessor.

APPARATUS REQUIRED:
8086 Microprocessor Kit, Keyboard, Power chord

ALGORITHM:

Step 1: Initialize the memory location to data pointer.


Step 2: Increment BL register.
Step 3: Increment accumulator by 1 and adjust to decimal.
Step 4: Compare the given decimal numbers with accumulator value.
Step 5: When both matches, the equivalent hexadecimal value is in BL register.

Step 6: Store the result on memory location.


Step 7: Stop the program.
PROGRAM:

MEMORY LABEL MNEMONICS OPCODE COMMENTS


LOCATION
1000 MOV SI, 2000 H C7, C6, 00, 20 DECLARE SI
1004 MOV DI, 3000 H C7, C7, 00, 30 DECLARE DI
MOVE THE DATA PRESENT IN
1008 MOV AL,[SI] 8A, 04 MEMORY LOCATION POINTED
BY SI TO AL
100A MOV DL,AL 88, C2 MOVE AL TO DL
100C AND DL,0F H 80, E2, 0F DL AND 0F IS AND ED
100F AND DL,0F0 H 80, E0, F0 AL AND F0 IS AND ED
1012 MOV CL,04 H C6, C1, D4 MOVE O4 H TO CL
ROTATE RIGHT AL CONTENT BY
1015 ROR AL,CL D2,C8
COUNT TIMES.
1017 MOV BL,0A H C6,C3,0A MOVE THE 0A H TO BL
101A MUL BL F6, E3 MULTIPLYING BL AND AL
101C ADD AL,DL 00, 00 ADD AL AND DL
MOVE DATA IN AL TO ADDRESS
101E MOV[DI], AL 88,05
OF DI
1020 HLT F4 STOP THE PROGRAM.

FLOWCHART:

65
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

OBSERVATION:
Input Data: Output Data:

GIVEN MEMORY
MEMORY INPUT LOCATION OUTPUT
LOCATION DATA 3000 H 18H
2000 H 24 H

RESULT:

Thus the program to convert decimal number to hexadecimal number was executed
and the output was verified.

66
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO:
CONVERT HEXADECIMAL TO DECIMAL
DATE :
AIM:
To write ALP (Assembly language program) to convert hexadecimal to decimal
using 8086 microprocessor.

APPARATUS REQUIRED:
8086 Microprocessor kit, Power Chord, Keyboard.

ALGORITHM:
Step 1: Initialize the memory location to data pointer.
Step 2: Increment BL Register
Step 3: Increment accumulator by 1 and adjust it to decimal every time.
Step 4: Compare the given hexadecimal number with BL register value.
Step 5: When both matches, the equipment location decimal value is in A register.
Step 6: Store the result in memory location.
Step7: Stop the program.
PROGRAM:
MEMORY LABEL MNEMONICS OPCODE COMMENTS
LOCATION
1000 MOV SI,2000 H C7,C6,00,20 DECLARE SI
1004 MOV DI, 3000 H C7,C7,00,30 DECLARE DI
MOVE THE DATA PRESENT IN
1008 MOV AL,[SI] 8A, 04 MEMORY LOCATION POINTER
BY SI TO AL
100A MOV DL,AL 88, C2 MOVE AL TO DL
100C AND DL, OF 80,E2,0F LOGICALLY AND DL & 0F H
100F AND AL,F0 80,E2,F0 LOGICALLY AND AL 7 F0 H
1012 MOV CL,04 H C6,C1,04 MOVE 04 H TO CL
ROTATE RIGHT AL BY COUNT 4
1015 ROR AL,CL D2,C8
TIMES.
1017 MOV BL,16 H C6,C3,16 MOVE 16 H TO BL
101A MUL BL F6,F3 MULTIPLY BL & AL
DECIMAL ADJUST AFTER
101C DAA 27
ADDITION
101D ADD AL,DL 00,D0 ADD DL AND AL
DECIMAL ADJUST AFTER
101F DAA 27
ADDITION
1020 MOV[DI],AL 88,05 MOVE AL TO ADDRESS DI
1022 HLT F4 STOP THE PROGRAM.

FLOWCHART:

67
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

OBSERVATION
INPUT:

ADDRESS GIVEN
DATA
2000 18 H
OUTPUT:

ADDRESS OUTPUT
DATA
3000 24 H

RESULT:
Thus the program to Convert Hexadecimal to Decimal numbers was executed
and the outputs was verified

68
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO:
8 BIT ADDITION USING 8051
DATE :

AIM:
To write and execute the assembly language program to add the two 8 bit numbers using
8051 microcotroller.
APPARATUS REQUIRED:
8051 Microcontroller kit, Power chord, Keyboard.
ALGORITHM:
(WITHOUT CARRY)
6. Get the input data and store it in accumulator.
7. Add the content with another input data.
8. Store the result in required memory location using DPTR.
9. Move accumulator content to DPTR.
Stop the program using SJMP.
(WITH CARRY)
8. Start the program by loading the first data into accumulator.
9. Move the data to A register.
10. Get the 2nd data and load into accumulator.
11. Add the two contents and check for carry.
12. Store the value of sum and carry in the memory location.
13. Stop the program.

69
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

PROGRAM:
WITHOUT CARRY
MEMORY LABEL MNEMONICS OPCODE COMMENTS
LOCATION
4100 MOV A,#04 H 74,04 MOVE DATA 04 H TO A
4102 ADD A,#02 H 24,02 ADD 01 H DATA WITH A
4104 MOV DPTR,#4700 H 90,47,00 MOVE 4700 H TO DPTR
4107 MOVX @DPTR,A F0 MOVE A TO DPTR
4108 STOP SJMP STOP 80,FE STOP THE PROGRAM USING SJMP

WITH CARRY
MEMORY LABEL MNEMONICS OPCODE COMMENTS
LOCATION
4100 MOV DPTR, # 4500 H 90,45,00 MOVE 4500 H TO DPTR
4103 MOV R1, # 00 H 79,00 MOVE 00H TO R1
4105 MOVX A,@DPTR E0 MOV DPTRTO A
4016 MOV R0,A F8 MOVE A TO R0 REGISTER
4017 INC DPTR A3 INCREMENT DPTR
4108 MOVX A,@DPTR E0 MOV DPTR TO A
4109 ADDC A,R0 38 ADD WITH CARRY R0 AND A
410A JNC NEXT 50,00 JUMP TO LABEL NEXT TO CR=0
410C NEXT INC R1 09 INCREMENT R1
410D MOV DPTR,# 4700 H 90,47,00 MOVE 4700 TO DPTR
4110 MOVX @DPTR,A F0 MOV A TO DPTR
4111 MOV A,R1 E9 MOV R1 TO A
4112 INC DPTR A3 INCREMENT DPTR
4113 MOVX @DPTR,A F0 MOVE A TO DPTR
4114 STOP SJMP STOP 80,FE STOP THE PROGRAM

70
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

FLOWCHART:
WITHOUT CARRY WITH CARRY

OBSERVATION (WITHOUT CARRY)


INPUT: OUTPUT:
ADDRESS GIVEN ADDRESS OUTPUT
DATA DATA
4101 H 02 H 4700 H 06 H
4103 H 04 H

WITH CARRY
INPUT OUTPUT

ADDRESS GIVEN ADDRESS GIVEN


DATA DATA
4500 H F0 H 4700 H E0 H
4501 H F0 H 4701 H 01 H

RESULT:
Thus the program for addition of two 8 bit numbers using 8051 microcontroller
was executed and the output was verified.

71
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO:
8 BIT SUBTRACTION USING 8051
DATE :
AIM:
To write and execute the assembly language program to the subtraction of two 8 bit
numbers using 8051 microcontroller.
APPARATUS REQUIRED:
8051 Microcontroller kit, Power cord, Keyboard.
ALGORITHM:
(WITHOUT BARROW)
1. Get the input data and store it in accumulator.
2. Subtract the accumulator content with another input data.
3. Store the result in required memory location using DPTR.
4. Move the accumulator content to DPTR.
5. Stop the program using SJMP.
(WITH BARROW)
1. Start the program by loading the first data into accumulator.
2. Move the data to A register.
3. Get the 2nd data and load into accumulator.
4. Subtract the two register contents and check the borrow.
5. If borrow is present then take the 2’s complement of accumulator content.
6. Store the value of Difference and Borrow in the memory location.
14. Stop the program using SJMP.

PROGRAM:
WITHOUT BORROW
MEMORY LABEL MNEMONICS OPCODE COMMENTS
LOCATION
4100 MOV A,#04 H 74,04 MOVE DATA 04 H TO A
4102 SUBB A,#02 H 94,02 SUBTRACT 02 H FROM A
4104 MOV DPTR,#4700 H 90,47,00 MOVE 4700 H TO DPTR
4107 MOVX @DPTR,A F0 MOVE A TO DPTR
4108 STOP SJMP STOP 80,FE STOP THE PROGRAM USING SJMP

WITH BORROW

72
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

MEMORY LABEL MNEMONICS OPCODE COMMENTS


LOCATION
4100 MOV DPTR, # 4500 H 90,45,00 MOVE 4500 H TO DPTR
4103 MOV R1, # 00 H 79,00 MOVE 00H TO R1
4105 MOVX A,@DPTR E0 MOV DPTRTO A
4016 MOV R0,A F8 MOVE A TO R0 REGISTER
4017 INC DPTR A3 INCREMENT DPTR
4108 MOVX A,@DPTR E0 MOV DPTR TO A
4109 SUBB A,R0 98 SUBTRACT WITH BORROW R0 & A
410A JNC NEXT 50,01 JUMP TO LABEL NEXT TO CR=0
410C NEXT INC R1 09 INCREMENT R1
410D MOV DPTR,# 4700 H 90,47,00 MOVE 4700 TO DPTR
4110 MOVX @DPTR,A F0 MOV A TO DPTR
4111 MOV A,R1 E9 MOV R1 TO A
4112 INC DPTR A3 INCREMENT DPTR
4113 MOVX @DPTR,A F0 MOVE A TO DPTR
4114 STOP SJMP STOP 80,FE STOP THE PROGRAM

FLOWCHART:
WITH OUT BORROW
WITH BORROW

OBSERVATION:
WITHOUT BORROW

73
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

INPUT: OUTPUT:
ADDRESS GIVEN ADDRESS OUTPUT
DATA DATA
4101 H 04 H 4700 H 02 H
4103 H 02 H

WITH BORROW
INPUT OUTPUT

ADDRESS GIVEN ADDRESS GIVEN


DATA DATA
4500 H 5B H 4700 H 3F H
4501 H 1C H 4701 H 00 H

ADDRESS GIVEN
ADDRESS GIVEN DATA
DATA 4700 H FE H
4500 H 02 H 4701 H 01 H
4501 H 04 H

RESULT:
Thus the program for Subtraction of two 8 bit numbers using 8051
microcontroller was executed and the output was verified.

74
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO:
8 BIT MULTIPLICATION USING 8051
DATE :

AIM:
To write and execute an assembly language program for multiply the two 8 bit numbers
using 8051 microcontroller.
APPARATUS REQUIRED:
8051 Microcontroller kit, Power cord, Keyboard.
ALGORITHM:
(WITHOUT CARRY)
7. Store the 1st input data in A-register & 2nd input data in B-register.
8. Multiply the A&B register content using MUL.
9. Initialize DPTR.
10. Move (or) access external memory to DPTR.
11. Increment DPTR & Store the result.
12. Stop the program using SJMP.

PROGRAM:
MEMORY LABEL MNEMONICS OPCODE COMMENTS
LOCATION
4100 MOV A,#04 H 74,04 MOVE 04 H TO A
4102 MOV B,#02 H 75,02,F0 MOVE 02 H TO B
4105 MUL AB A4 MULTIPLY A&B
4106 MOV DPTR,#4700 H 90,47,00 MOVE 4700 H TO DPTR
4109 MOVX @DPTR,A F0 MOVE A TO DPTR
410A INC DPTR A3 INCREMENT DPTR
410B MOV A,B E5,F0 MOVE B REG GO TO A REG
410D MOVX @DPTR,A F0 MOVE A TO DPTR
410E STOP SJMP STOP 80,FE STOP THE PROGRAM

FLOWCHART:

75
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

OBSERVATION:

INPUT: OUTPUT:
ADDRESS GIVEN ADDRESS OUTPUT
DATA DATA
4101 H 04 H 4700 H 08 H
4104 H 02 H 4701 H 00 H

RESULT:
Thus the program for multiplication of two 8-bit numbers using
8051 microprocessors was executed and the result was verified.

76
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

EX NO:
8 BIT DIVISION USING 8051
DATE :

AIM :
To write and execute an assembly language program to divide the two 8-bit
numbers using 8051 microcontroller.
APPARATUS REQUIRED:
8051 Microcontroller Kit, Power Chord, Keyboard.
ALGORITHM:
1.Get the two 8-bit data as input, store one 8-bit data in A register & other to
B-register.
2.Divide the A register content with b-register content.
3. store the result, that is quotient and remainder in required to memory
location using DPTR.
4. Stop the program using SJMP.

PROGRAM:
MEMORY LABEL MNEMONICS OPCODE COMMENTS
LOCATION
4100 MOV A,#04 H 74, 04 Move 04 H To A Register
4102 MOV B,#02 H 75, 02, F0 Move 02 H To B Register
4105 DIV AB 84 Divide A And B
4106 MOV DPTR,#4700 H 90, 47, 00 Initialize DPTR
4109 MOVX @DPTR,A F0 Move A To DPTR
410A INC DPTR A3 Increment DPTR
410B MOV A,B E5, F0 Move B To A
410C MOVX @DPTR,A F0 Move A To DPTR
410E STOP SJMP STOP 80, FE Stop The Program Using SJMP

77
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

FLOWCHART:

OBSERVATION:

INPUT: OUTPUT:
ADDRESS GIVEN ADDRESS OUTPUT
DATA DATA
4101 H 04 H 4700 H 02H
4104 H 02 H 4701 H 00 H

RESULT:
Thus the program for division of two 8-bit numbers using 8051
microprocessors was executed and the result was verified.

EX NO: 3
DATE : MATRIX DISPLAY

78
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

AIM :
To write a program to perform the matrix display using interfacing card

APPARATUS REQUIRED:

SL.NO EQUIPMENTS NAME QTY


1 8051 Microprocessor kit 1
2 Matrix - Interface board 1
3 Power Chord 2
4 Keyboard 1
5 Small Bus bar 1
6 CRO 1
7 CRO PROBE 1

ALGORITHM:
• Type the code in microprocessor kit using keyboard.
• Execute the code and get the output in matrix display.
• Move the data 80 H to accumulator AL.
• Out the AL data to 26
• Move FF data to accumulator AL
• Out the AL data to 20
• Move 0F data to accumulator AL
• Out the AL data to 22
• Stop The Program.
PROGRAM:
MEMORY
LABEL MNEMONICS OPCODE COMMENTS
LOCATION
1000 MOV AL,80 H C6, C0, 80 Move 80 H TO AL

1003 OUT 26, AL E6, 26 Out AL data to 26


1005 MOV AL, FF E6,C0, FF Move FF to AL

1008 OUT 20, AL E6,20 Out AL data to 20

100A MOV AL, 0F C6, C0, 0F Move 0F to AL

100D OUT 22, AL E6,22 Out AL data to 22

100F HLT F4 Stop the program

79
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

MATRIX OUTPUT:

RESULT:
Thus The Interface Of Matrix Display Using 8086 Microprocessor Is Studied And Output
Is Verified.

80
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB

81

You might also like