Cse-Mpmc Lab Manual
Cse-Mpmc Lab Manual
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
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
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:
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:
1000 MOV DX,0000 H C7, C2, 00, 00 CLEAR THE KIT MEMORY.
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:
1000 MOV DX,0000 H C7, C2, 00, 00 CLEAR THE KIT MEMORY.
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
RESULT:
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:
16
FLOWCHART:
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB
OBSERVATION:
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
100B BACK MOV AL,[SI] 8A,04 MOVE DATA PRESENT IN MEMORY ADDRESS POINTED BY SI TO AL
101C JNZ BACK 75,ED JUMP ON NO ZERO, IF COUNT NOT ‘0’ GO TO BACK
1020 JNZ REPEAT 75,E3 IF COUNT NOT EQUAL TO ‘0’ GO TO LABEL REPEAT
18
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB
FLOWCHART:
INPUT: OUTPUT:
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:
RESULT:
Thus the program for arranging in Descending order was executed and the output was verified.
21
EBEC22L07 MICROPROCESSOR AND MICROCONTROLLER LAB
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.
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
1009 MOV SI,LABEL C7, C6,7F,10 Move label to source index register
24
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB
25
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB
OBSERVATION:
INPUT
DB 1073: 12H, 27H, 44H, 10H LOOK UP
1077: 2BH, 92H, 10H, 9DH
107B: 84H, 48H, 2EH, 84H
ORG 1000
CNTRL EQU 26H
PORTA EQU 20H
PORTB EQU 22H
PORTC EQU 24H
26
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB
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:
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:
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:
31
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB
1 1 0 0 1 1 0 0
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
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.
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
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:
PROCEDURE:
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
OUTPUT
0 0 0 0 0 0 0 0
0-LOW OFF
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:
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
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
WITH CARRY
INPUT OUTPUT
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
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 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:
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 :
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:
APPARATUS REQUIRED:
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
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:
APPARATUS REQUIRED:
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
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
EX NO:
64
BEC18L14 MICROPROCESSOR AND MICROCONTROLLER LAB
APPARATUS REQUIRED:
8086 Microprocessor Kit, Keyboard, Power chord
ALGORITHM:
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
WITH CARRY
INPUT OUTPUT
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
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 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:
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
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