0% found this document useful (0 votes)
98 views94 pages

Lab Record: Government College of Engineering Sengipatti, Thanjavur

The document contains the syllabus for the Microprocessor and Microcontroller Laboratory course. It lists 16 experiments involving 8086 and 8051 microprocessors/microcontrollers including basic arithmetic operations, interfacing with peripherals, and conversions. It provides the introduction, list of experiments, and expected outcomes for the course.

Uploaded by

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

Lab Record: Government College of Engineering Sengipatti, Thanjavur

The document contains the syllabus for the Microprocessor and Microcontroller Laboratory course. It lists 16 experiments involving 8086 and 8051 microprocessors/microcontrollers including basic arithmetic operations, interfacing with peripherals, and conversions. It provides the introduction, list of experiments, and expected outcomes for the course.

Uploaded by

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

GOVERNMENT COLLEGE OF ENGINEERING

Sengipatti, Thanjavur
DEPARMENT OF ELECTRONICS AND COMMUNICATION
ENGINEERING

LAB RECORD

Regulation : 2017

Branch : B.E. – ECE

Year & Semester : III Year / VI Semester

EC68681- MICROPROCESSORANDMICROCONTROLLER LABORATORY


ANNA UNIVERSITY CHENNAI

Regulation 2017
EC8681- MICROPROCESSOR AND MICROCONTROLLER LABORATORY

SYLLABUS

LIST OF EXPERIMENTS

8086 Programs using kits and MASM

1. Basic arithmetic and Logical operations


2. Move a data block without overlap
3. Code conversion, decimal arithmetic and Matrix operations.
4. Floating point operations, string manipulations, sorting and searching
5. Password checking, Print RAM size and system date
6. Counters and Time Delay

Peripherals and Interfacing Experiments

7. Traffic light control


8. Stepper motor control
9. Digital clock
10.Key board and Display
11.Printer status
12.Serial interface and Parallel interface
13.A/D and D/A interface and Waveform Generation.
Experiments using kits and MASM

14. Basic arithmetic and Logical operations


15. Square and Cube program, Find 2’s complement of a number
16. Unpacked BCD to ASCII

TOTAL: 60 PERIODS
INTRODUCTION TO MICROPROCESSORS & MICROCONTROLLERS

Microprocessor: is a computer processor which incorporates the functions of


a computer's central processing unit (CPU) on a single integrated circuit (IC) at most a
few integrated circuits. The microprocessor is a
multipurpose, clock driven, register based, digital-integrated circuit which
accepts binary data as input, processes it according to instructions stored in
its memory, and provides results as output. Microprocessors contain
both combinational logic and sequential digital logic. Microprocessors operate on
numbers and symbols represented in the binary numeral system.

Microcontroller: is a small computer on a single integrated circuit. In modern


terminology, it is a system on a chip or SoC. A microcontroller contains one or
more CPUs along with memory and programmable input/output peripherals. Program
memory in the form of Ferroelectric RAM, NOR flash or OTP ROM is also often
included on chip, as well as a small amount of RAM. Microcontrollers are designed
for embedded applications, in contrast to the microprocessors used in personal
computers or other general purpose applications consisting of various discrete chips.
INDEX

Exp. Page
Date Name of the Experiment No. Marks Signature
No
16 Bit Addition Using Arithmetic
1 Operation
of 8086 Microprocessor
16 Bit Subtraction Using Arithmetic
2
Operation of 8086 Microprocessor
16 Bit Multiplication Using Arithmetic
3
Operation of 8086 Microprocessor
16 Bit Division Using Arithmetic Operation
4
of 8086 Microprocessor
Logical Operations Using 8086
5
Microprocessor

6 Move a Data Block Without Overlap


Code Conversion –Decimal To
7
Hexadecimal
Code Conversion –Hexadecimal To
8
Decimal
String Manipulations, Sorting And
9
Searching- Ascending & Descending

10 Largest & Smallest

11 Password Checking Using MASM

12 Traffic Light Control

13 Stepper Motor Controller


Interfacing Programmable
14
Keyboard And Display Controller- 8279

15 Interfacing Analog -To -Digital Converter


Interfacing Digital - To – Analog
16
Converter
8 Bit Addition Using Arithmetic
17
Operation 8051 Microcontroller
8 Bit Subtraction Using Arithmetic
18
Operation 8051 Microcontroller
8 Bit Multiplication Using Arithmetic
19
Operation 8051 Microcontroller
8 Bit Division Using Arithmetic Operation
20
8051 Microcontroller
21 Find 2’s Complement Of A Number
Logical Operations Using 8051
22
Microcontroller
MICROPROCESSOR AND MICROCONTROLLER 1
LABORATORY
Ex. NO: 01
DATE:
16 BIT (ADDITION) ARITHMETIC OPERATION USING 8086 MICROPROCESSOR

AIM:

To write an assembly language program to perform addition of two 16 bit numbers


using 8086.
APPARATUS REQUIRED:

S.NO ITEM SPECIFICATION QUANTITY

1. MICROPROCESSOR KIT 8086 1

2. POWER SUPPLY + 5 V DC 1

3. KEY BOARD - 1

ALGORITHM:
16- bit addition

➢ Get the first number is specific address.


➢ Add the second number to the first number.
➢ Add the two values.
➢ Store the sum and carry.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
FLOW CHART:
ADDITION:
PROGRAM FOR ADDITION;

ADDRESS OPCODE LABEL MNEMONICS COMMENT

5000 MOV CX,0000H Initialize counter CX

Get the first data in AX


5003 MOV AX,[5200]
register.

Get the second data in BX


5006 MOV BX, [5202]
register.

Add the contents of both


500A ADD AX,BX the register AX & BX

500C JNC L1 Check for carry

If carry exists, increment


500E INC CX the CX

500F LI MOV [5206],CX Store the carry

5013 MOV [5204], AX Store the sum

5016 INT 3 Stop the program

OUTPUT FOR ADDITION:

ADDRESS DATA

INPUT 5200
5201
5202
5203
5204
OUTPUT 5205
5206

RESULT:
Thus the assembly language program to perform addition of two 16 bit
numbers using 8086 Performed and the result is stored.
MICROPROCESSOR AND MICROCONTROLLER 4
LABORATORY
Ex. NO: 02
DATE:
16 BIT ARITHMETIC OPERATION (SUBTRACTION )
USING 8086 MICROPROCESSOR
AIM:

To write an assembly language program to perform subtraction of two 16 bit


numbers using 8086.

APPARATUS REQUIRED:

S.NO ITEM SPECIFICATION QUANTITY

1. MICROPROCESSOR KIT 8086 1

2. POWER SUPPLY + 5 V DC 1

3. KEY BOARD - 1

ALGORITHM:

16- bit SUBTRACTION:

➢ Initialize the MSBs of difference to 0


➢ Get the first number
➢ Subtract the second number from the first number.
➢ If there is any borrow, increment MSBs of difference by 1.
➢ Store LSBs of difference.
➢ Store MSBs of difference.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


FLOECHART:

SUBTRACTION:
PROGRAM FOR SUBTRACTION:

ADDRESS OPCODE LABEL MNEMONICS COMMENT

5000 MOV CX,0000H Initialize counter CX

Get the first data in AX


5003 MOV AX,[5300]
register

Get the second data in BX


5006 MOV BX, [5302]
register.

Subtract the contents of both


500A SUB AX,BX the register AX & BX

500C JNC 500F Check the Borrow.

If carry exists, increment the


500E INC CX CX

500F MOV [5306],CX Store the Borrow.

5013 MOV [5304], AX Store the difference.

5016 INT 3 Stop the program

OUTPUT FOR SUBTRACTION:

ADDRESS DATA

5300
5301
INPUT
5302
5303
5304
OUTPUT 5305
5306

RESULT:

Thus the assembly language program to perform subtraction of two 16 bit


numbers using 8086 Performed and the result is stored.
Ex. NO: 03
DATE:
16 BIT MULTIPLICATION USING 8086 MICROPROCESSOR

AIM:

To write an assembly language program to perform Multiplication of two 16


bit numbers using 8086.
APPARATUS REQUIRED:

S.NO ITEM SPECIFICATION QUANTITY

1. MICROPROCESSOR KIT 8086 1

2. POWER SUPPLY + 5 V DC 1

3. KEY BOARD - 1

ALGORITHM:
16- bit MULTIPLICATION

Multiplication of 16-bit numbers:

➢ Get the multiplier.


➢ Get the multiplicand
➢ Initialize the product to 0.
➢ Product = product + multiplicand
➢ Decrement the multiplier by 1.
➢ If multiplicand is not equal to 0, repeat from step (d) otherwise store the
product.
FLOECHART:

MULTIPLICATION:
PROGRAM FOR MULTIPLICATION:

ADDRESS OPCODE LABEL MNEMONICS COMMENT

Get the first data in AX


5000 MOV AX,1234H
register.

Get the second data in BX


5003 MOV BX,0100H
register.

5006 MUL BX Multiply AX & BX data

5008 INT 3 Break point.

OUTPUT FORV MULTIPLICATION:

INPUT

OUTPUT

RESULT:

Thus the assembly language program to perform multiplication of two


16 bit numbers using 8086 Performed and the result is stored.
Ex. NO: 04
DATE:
16 BIT DIVISION USING 8086 MICROPROCESSOR

AIM:

To write an assembly language program to perform division of two 16 bit


numbers using 8086.
APPARATUS REQUIRED:

S.NO ITEM SPECIFICATION QUANTITY

1. MICROPROCESSOR KIT 8086 1

2. POWER SUPPLY + 5 V DC 1

3. KEY BOARD - 1

ALGORITHM:

16- bit division


Division of 16-bit numbers:
➢ Get the dividend and divisor.
➢ Initialize the quotient to 0.
➢ Dividend = dividend–divisor
➢ If the divisor is greater, store the quotient
➢ Go to step 3
➢ If dividend is greater, quotient = quotient+ repeat from step 4.
FLOECHART:

DIVISION:
PROGRAM FOR DIVISION:

ADDRESS OPCODE LABEL MNEMONICS COMMENT

Get the first data in AX


5000 MOV AX,[5200]
register,

Get the second data in DX


5003 MOV DX,[5202]
register.

5007 MOV BX,[5204] Move the higher order data.

500D MOV [5206],AX Move ax register into address

Divide the dividend by


500B DIV BX divisor

5010 MOV AX,BX Copy the lower order data

5012 MOV [5208],AX Store the higher order data.

Stop the program.


5015 INT 3

OUTPUT FOR DIVISION:

ADDRESS DATA

5200
5201
INPUT
5202
5203

5208
OUTPUT
5209

RESULT:
Thus the assembly language program to perform division of two 16 bit
numbers using 8086 Performed and the result is stored.
EX. NO: 05
DATE :
LOGICAL OPERATIONS USING 8086 MICROPROCESSOR
AIM:

To implement logic gates

APPARATUS REQUIRED:

S.NO ITEM SPECIFICATION QUANTITY

1. MICROPROCESSOR KIT 8086 1

2. POWER SUPPLY + 5 V DC 1

3. KEY BOARD - 1

ALGORITHM:

➢Initialize the memory location to the data pointer AL Register

➢Increment B register.

➢Increment accumulator by 1 and adjust it to decimal every time.

➢Compare the given decimal number with accumulator value.

➢Perform the given logical function value is in B register.

➢Store the resultant in memory location.


PROGRAM FOR “AND” LOGIC

ADDRESS OPCODE LABEL MNEMONICS COMMENT

5000 MOV AL,04 Move data 04 to AL register

5003 MOV BL,03 Move data 03 to BL register

5007 AND AL,BL AND Operation

500D MOV [5100],AL Result store in 5100 address

500B INT 3 Stop the program

PROGRAM FOR “OR” LOGIC

ADDRESS OPCODE LABEL MNEMONICS COMMENT

5000 MOV AL,05 Move data 05 to AL register

5003 MOV BL,04 Move data 04 to BL register

5007 OR AL,BL OR Operation

500D MOV [5100],AL Result store in 5100 address

500B INT 3 Stop the program


PROGRAM FOR “EX- OR” LOGIC

ADDRESS OPCODE LABEL MNEMONICS COMMENT

5000 MOV AL,04 Move data 04 to AL register

5003 MOV BL,03 Move data 03 to BL register

5007 XOR AL,BL EX-OR Operation

500D MOV [5100],AL Result store in 5100 address

500B INT 3 Stop the program

OUTPUT:

GATE INPUT OUTPUT

AND

OR

EX-OR

RESULT:
Thus the assembly language program to perform logical operations AND, OR
& EX-OR using 8086 Performed and the result is stored.
EX. NO: 06
DATE :
MOVE A DATA BLOCK WITHOUT OVERLAP
AIM:

To move a data block without overlap

APPARATUS REQUIRED:

S.NO ITEM SPECIFICATION QUANTITY

1. MICROPROCESSOR KIT 8086 1

2. POWER SUPPLY + 5 V DC 1

3. KEY BOARD - 1

ALGORITHM:

➢Initialize the memory location to the data pointer.

➢Increment B register.

➢Increment accumulator by 1 and adjust it to decimal every time.

➢Compare the given decimal number with accumulator value.

➢When both match, the equivalent hexadecimal value is in B register.

➢Store the resultant in memory location.


PROGRAM:

ADDRESS OPCODES PROGRAM COMMENTS

5000 MOV CL, 05 Get the Data range

5002 MOV SI, 5400 Get the first data.

5005 MOV DI, 5450 Get the second data.


Store the lower order
5008 LD DSB
product
5009 MOV [DI], AL Store the result

500B INC DI Increment the pointer.

500C DEC 5008 Dec Counter 0

5010 INT 3 Stop the program

OUTPUT:

INPUT OUTPUT
5400 5450
5401 5451
5402 5452
5403 5453
5404 5454

RESULT:

Thus the output for the Move a data block without overlap was executed
successfully.
EX. NO: 07
DATE :
CODE CONVERSION-DECIMAL TO HEXADECIMAL

AIM:

To convert a given decimal number to hexadecimal.

ALGORITHM:
➢Initialize the memory location to the data pointer.
➢Increment B register.
➢Increment accumulator by 1 and adjust it to decimal every time.
➢Compare the given decimal number with accumulator value.
➢When both match, the equivalent hexadecimal value is in B register.
➢Store the resultant in memory location.
FLOWCHART:
MICROPROCESSOR AND MICROCONTROLLER 20
LABORATORY
PROGRAM:

ADDRESS OPCODE LABEL MNEMONICS COMMENDS

5000 MOV AL, [5100] Move data block AL

5003 MOV AH, AL Move data lower to higher

5005 MOV AH, 0F Move data OF into AH

5008 MOV BL, AH Move data BL into AH

500A AND AL, F0 AND the data AL to FO

500C MOV CL, 04 Move data 04 to CL block

500E ROR AL, CL Rotate functions CL and AL

5010 MOV BH, 0A Move data OA into BH

5012 MUL BH Multiply BH

5014 ADD AL, BL ADD the data AL And BL

5016 MOV [6000], AL Move the store data

5019 INT 3 Stop the program

OUTPUT:[DECIMAL TO HEXADECIMAL]

DATA ADDRESS DATA

INPUT

OUTPUT

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
RESULT:
Thus the code conversion of decimal to hexadecimal was executed
successfully.
EX. NO: 08
DATE :
CODE CONVERSION –HEXADECIMAL TO DECIMAL

AIM:

To convert a given hexadecimal number to decimal

ALGORITHM:
➢ Initialize the memory location to the data pointer.
➢ Increment B register.
➢ Increment accumulator by 1 and adjust it to decimal every time.
➢ Compare the given hexadecimal number with B register value.
➢ When both match, the equivalent decimal value is in A register.
➢ Store the resultant in memory location.
PROGRAM;

ADDRESS OPCODE LABEL MNEMONICS COMMENTS

5000 MOV AL, [5100] Move date to AL REG

5003 MOV DX, 0000 Move data AL TO DX

5006 HUND CMP AL, 64 Move data to AX REG

5008 JC TEN Jump carry

500A SUB AL, 64 Subtract data

500C INC DL Increment DL

500E JMP HUND JUMP label data

5010 TEN CMP AL, 0A Compare register

5012 JC UNIT Jump carry

5014 SUB AL,0A Subtract data

5016 INC DH Increment DH

5018 JMP TEN JUMP carry

501A UNIT MOV [6000],DL Move data to DL

501E MOV [6001],DH Move data to DH

5022 MOV [6002],AL Move data to AL

5025 MOV [6003],AH Move data to AH

5027 HLT Stop the program


OUTPUT:

INPUT OUTPUT

MEMORY

DATA

RESULT:

Thus the code conversion of decimal to hexadecimal was executed


successfully.
EX. NO: 09
DATE :
STRING MANIPULATION - SORTING & SEARCHING

ASCENDING & DESCENDING


AIM:

To write an Assembly Language Program (ALP) to sort a given array in


Ascending and Descending order

APPARATUS REQUIRED:

S.NO ITEM SPECIFICATION QUANTITY

1. MICROPROCESSOR KIR 8086 KIT 1

2. POWER SUPPLY + 5 V DC 1

3. KEY BOARD - 1

PROBLEM STATEMENT:
An array of length 05 is given from the location. Sort it into descending and
ascending order and store the result.
ALGORITHM:

Sorting in ascending order:


➢ Load the array count in two registers C1 and C2.
➢ Get the first two numbers.
➢ Compare the numbers and exchange if necessary so that the two numbers are in
ascending order.
➢ Decrement C2.
➢ Get the third number from the array and repeat the process until C2 is 0.
➢ Decrement C1 and repeat the process until C1 is 0.

Sorting in descending order:


➢ Load the array count in two registers C1 and C2.
➢ Get the first two numbers.
➢ Compare the numbers and exchange if necessary so that the two numbers are in
descending order.
➢ Decrement C2.
➢ Get the third number from the array and repeat the process until C2 is 0.
➢ Decrement C1 and repeat the process until C1 is 0.
FLOECHART:[ASCENDING]:
FLOWCHART :[DECENDING]:
PROGRAM FOR ASCENDING ORDER:

ADDRESS LABEL PROGRAM COMMENTS


Initialize memory location for
5000 MOV SI,5200H
array size
5002 MOV CL,[SI] Number of comparisons in CL
Initialize memory location for
5004 L4 : MOVSI,5200H
array size
5005 L4 MOV DL,[SI] Get the count in DL

5007 INC SI Go to next memory location

500D L3 MOV AL,[SI] Get the first data in AL

501B L1 L3 : INC SI Go to next memory location

501E L2 MOV BL,[SI] Get the second data in BL

5010 CMP AL,BL Compare two data’s

5012 JNB L1 If AL < BL go to L1


Else, Decrement the memory
5014 DEC SI
location
5016 MOV [SI],AL Store the smallest data

5018 MOV AL,BL Get the next data AL

5019 JMP L2 Jump to L2

501A L1 DEC SI Decrement the memory location


Store the greatest data in memory
501C MOV [SI],BL
location
L2 INC SI Go to next memory location
501E

5020 DEC DL Decrement the count


Jump to L3, if the count is not
5022 JNZ L3
reached
5024 MOV [SI],AL Store data in memory location

5026 DEC CL Decrement the count


Jump to L4, if the count is not
5028 JNZ L4
reached zero
5029 HLT Stop the program
PROGRAM FOR DESCENDING ORDER:

ADDRESS OPCODES PROGRAM COMMENTS

Initialize memory location


5000 MOV SI,6000H
for array size

Number of comparisons in
5002 MOV CL,[SI]
CL

L4 : MOV Initialize memory location


5004 SI,6000H for array size

5006 MOV DL,[SI] Get the count in DL

Go to next memory
5007 INC SI
location

5009 MOV AL,[SI] Get the first data in AL

Go to next memory
500B L3 INC SI
location

Move the data SI reg into


500D MOV BL,[SI]
BL reg

Compare BC and AL
500F CMP AL,BC
register

5010 JB 501B Jump given address

5012 DEC SI Decrement SI

Move the data AL register


5014 MOV [SI],AL
into SI register

5016 MOV AL,BL Move the data AL into BL

5018 JMP 501E Jump given address


501A DEC SI Decrement SI

Move the data AL into SI


501C MOV [SI],AL
register

501E INC SI Increment SI

5020 DEC SI Decrement SI

5022 JNZ 5000 Jump no zero

5024 MOV [SI],AL Move AL into SI register

5026 DEC CL Decrement CL

5028 JNZ 5005 Jump no zero 5005

502A INT 3 Stop the program


OUTPUT FOR ASCENDING:

DATA

INPUT

OUTPUT

OUTPUT FOR DESCENDING ORDER:

DATA

INPUT

OUTPUT

RESULT:

Thus the given array of numbers are sorted in ascending & descending order.
EX. NO: 10
DATE :
LARGEST & SMALLEST
AIM:

To write an Assembly Language Program(ALP) to find the Largest and


Smallest number in a given array.

APPARATUS REQUIRED:

S.NO ITEM SPECIFICATION QUANTITY

1. MICROPROCESSOR KIT 8086 1

2. POWER SUPPLY + 5 V DC 1

3. KEY BOARD - 1

PROBLEM STATEMENT:
An array of length 5 is given from the location. Find the largest and smallest
number and store the result.
ALGORITHM:

i(ni)dingFlargest number:
➢ Load the array count in a register C1.
➢ Get the first two numbers.
➢ Compare the numbers and exchange if the number is small.
➢ Get the third number from the array and repeat the process until C1 is 0.

(ii) Finding smallest number:


➢ Load the array count in a register C1.
➢ Get the first two numbers.
➢ Compare the numbers and exchange if the number is large.
➢ Get the third number from the array and repeat the process until C1 is 0.
FLOECHART:[LARGEST]
FLOECHART:[SMALLEST]
PROGRAM FOR FINDING LARGEST NUMBER:

ADDRESS OPCODES PROGRAM COMMENDS

5000 MOV SI,6000H Initialize array size

5002 MOV CL,[SI] Initialize the count

5004 INC SI Go to next memory location

5006 MOV AL,[SI] Move the first data in AL

5007 DEC CL Reduce the count

5009 INC SI Move the SI pointer to next data

500A L2 CMP AL,[SI] Compare two data’s

500E JNB L1 If AL > [SI] then go to L1 ( no swap)

5011 L1 MOV AL,[SI] Else move the large number to AL

5012 L1 : DEC CL Decrement the count

5014 JNZ L2 If count is not zero go to L2

5016 MOV DI,5300H Initialize DI with 5300H

MOV [DI],AL Else store the biggest number in 5300


5018
location

501A HLT Stop the program


PROGRAM FOR FINDING SMALLEST NUMBER:

ADDRESS OPCODES PROGRAM COMMENDS

5000 MOV SI,6000H Initialize array size

5002 MOV CL,[SI] Initialize the count

5004 INC SI Go to next memory location

5006 MOV AL,[SI] Move the first data in AL

5007 DEC CL Reduce the count

5009 L2 : INC SI Move the SI pointer to next data

500A L2 CMP AL,[SI] Compare two data’s

500E JB L1 If AL < [SI] then go to L1 ( no swap)

5011 L1 MOV AL,[SI] Else move the large number to AL

5012 L1 : DEC CL Decrement the count

5014 JNZ L2 If count is not zero go to L2

5016 MOV DI,5300H Initialize DI with 5300H

5018 MOV [DI],AL Else store the biggest number in 5300 location

5010 HLT Stop the program


OUTPUT FOR LARGESTNUMBER:

DATA

INPUT

OUTPUT

OUTPUT FOR SMALLEST NUMBER:

DATA

INPUT

OUTPUT

RESULT:

Thus the largest and smallest number is found in a given array.


EX. NO: 11
DATE :

PASSWORD CHECKING
AIM:

To write an Assembly Language Program (ALP) for performing the


Password checking by using MASM

APPARATUS REQUIRED:

SL .No ITEM SPECIFICATION QUANTITY

1. Microprocessor kit 8086 kit 1


2. Power Supply +5 V dc 1

PROGRAM:

; PASSWORD IS

MASM1234 DATA SEGMENT

PASSWORD DB

'MASM1234' LEN EQU

($-PASSWORD)

MSG1 DB 10, 13,'ENTER YOUR PASSWORD: $'

MSG2 DB 10, 13,' WELCOME TO ELECTRONICS WORLD!!

$' MSG3 DB 10, 13,'INCORRECT PASSWORD!$'

NEW DB 10, 13,'$'

INST DB 10 DUP

(0) DATA ENDS

CODE SEGMENT
EC6513- MICROPROCESSOR AND MICROCONTROLLER 41
LABORATORY

ASSUME CS: CODE, DS:

DATA START:

MOV AX, DATA

MOV DS, AX

LEA DX, MSG1

MOV AH, 09H

INT 21H

MOV SI, 00

UP1:

MOV AH,

08H INT

21H

CMP AL,

0DH JE

DOWN

MOV [INST+SI],

AL MOV DL,'*'

MOV AH, 02H

INT 21H

INC SI

JMP

UP1

DOWN:

MOV BX, 00

MOV CX,

LEN CHECK:

MOV AL,[INST+BX]

MOV DL,

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
EC6513- MICROPROCESSOR AND MICROCONTROLLER 42
LABORATORY
[PASSWORD+BX] CMP

AL, DL

JNE FAIL

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
MICROPROCESSOR AND MICROCONTROLLER 42
LABORATORY

INC BX

LOOP

CHECK

LEA DX, MSG2

MOV AH, 09H

INT 21H

JMP FINISH

FAIL:

LEA DX, MSG3

MOV AH, 009H

INT 21H

FINISH:

INT 3

CODE

ENDS END

START

END

RESULT:
Thus the output for the Password checking, Print RAM size and system date
was executed successfully

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
MICROPROCESSOR AND MICROCONTROLLER 43
LABORATORY
EXP.NO: 12

DATE :

TRAFFIC LIGHT CONTROLLER


AIM:

To write an assembly language program in 8086 to Traffic light control

APPARATUS REQUIRED:

SL .No ITEM SPECIFICATION QUANTITY

1. Microprocessor kit 8086 kit 1

2 Traffic Light Controller - 1


module
2. Parallel Bus - 1

PROGRAM;

➢ Log into System.


➢ Select control type.
➢ If Automatic mode select then go to step 4th else go to step 8.
➢ If Automatic control activated.
➢ Assign time period for green, yellow signal.
➢ Assign time period for green, yellow signal according to that particular road.
➢ go to step 4.
MICROPROCESSOR AND MICROCONTROLLER 44
LABORATORY
MODEL GRAPH FOR TRAFFIC LIGHT CONTROL:

ROAD
PC6 PC5 RY 2 PC1 PC0 PA2
PC4
G
GYR

ROAD 1

ROAD 3

ROAD PA4 PA3


GY
RYG 4 PA7
R
PB7 PB6 PB5
MICROPROCESSOR AND MICROCONTROLLER 45
LABORATORY

ROAD TRAFFIC LIGHT SEQUENCE

SEQUENCE NO ROAD 4 ROAD 3 ROAD 2 ROAD 1


1 G R G R
2 R Y R Y
3 R G R G
4 Y R Y R

DATA ON PORT AS PER SEQUENCE

SEQUENCE D7 D6 D5 D4 D3 D2 D1 D0 VALUE
PORT A 1 0 0 0 0 0 0 0 80H
PORT B 1 0 0 0 0 0 0 0 80H
GRGR
PORT C 0 0 0 1 0 0 1 0 12H
PORT A 0 0 0 1 0 0 0 0 10H
PORT B 0 1 0 0 0 0 0 0 40H
RYRY
PORT C 0 1 0 0 0 0 0 1 41H
PORT A 0 0 0 1 0 1 0 0 14H
PORT B 0 0 1 0 0 0 0 0 20H
RGRG
PORT C 0 1 0 0 0 0 0 0 40H
PORT A 0 0 0 0 1 0 0 0 08H
YRYR
PORT B 1 0 0 0 0 0 0 0 80H
PORT C 0 0 1 0 0 0 1 0 22H
MICROPROCESSOR AND MICROCONTROLLER 46
LABORATORY

START

SEND DATA’s TO PORT A, B, C FOR SEQ 1

DELAY

SEND DATA’s TO PORT A, B, C FOR SEQ 2

DELAY

SEND DATA’s TO PORT A, B, C FOR SEQ 3

DELAY

SEND DATA’s TO PORT A, B, C FOR SEQ 4

DELAY

STOP
MICROPROCESSOR AND MICROCONTROLLER 47
LABORATORY
ASSEMBLY LANGUAGE PROGRAM FOR TRAFFIC LIGHT CONTROL:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS

1000 MOV AL,80

OUT 26,AL

START MOV AL,80

OUT 20, AL

MOV AL,80

OUT 22, AL

MOV AL,12

OUT 24, AL

CALL DELAY

MOV AL,10

OUT 20, AL

MOV AL,40

OUT 22, AL

MOV AL,41

OUT 24, AL

CALL DELAY

MOV AL,14

OUT 20, AL

MOV AL, 20

OUT 22, AL

MOV AL, 40

OUT 24, AL
MICROPROCESSOR AND MICROCONTROLLER 48
LABORATORY
CALL DELAY

MOV AL, 08

OUT 20, AL

MOV AL,80

OUT 22, AL

MOV AL, 22

OUT 24, AL

CALL DELAY

JMP START

1500 DELAY MOV DI , 0040

L2 MOV DX, FFFF

L1 DEC DX

JNZ L1

DEC DI

JNZ L2

RET


MICROPROCESSOR AND MICROCONTROLLER 49
LABORATORY

RESULT:

Thus the assembly language program for traffic light control is verified
MICROPROCESSOR AND MICROCONTROLLER 50
LABORATORY
EX. NO: 13

DATE :

STEPPER MOTOR INTERFACING

AIM:

To write an assembly language program in 8086 to rotate the motor at


different speeds.

APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY

1. Microprocessor kit 8086 1


2. Power Supply +5 V, dc,+12 V dc 1
3. Stepper Motor Interface board - 1
4. Stepper Motor - 1

PROBLEM STATEMENT:

Write a code for achieving a specific angle of rotation in a given time and
particular number of rotations in a specific time.

THEORY:

A motor in which the rotor is able to assume only discrete stationary


angular position is a stepper motor. The rotary motion occurs in a stepwise manner
from one equilibrium position to the next. Two-phase scheme: Any two adjacent
stator windings are energized. There are two magnetic fields active in quadrature
and none of the rotor pole faces can be in direct alignment with the stator poles. A
partial but symmetric alignment of the rotor poles is of course possible.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
ALGORITHM:

For running stepper motor clockwise and anticlockwise directions

➢ Get the first data from the lookup table.


➢ Initialize the counter and move data into accumulator.
➢ Drive the stepper motor circuitry and introduce delay
➢ Decrement the counter is not zero repeat from step(iii)
➢ Repeat the above procedure both for backward and forward directions.

SWITCHING SEQUENCE OF STEPPER MOTOR:

MEMORY
LOCATION A1 A2 B1 B2 HEX CODE

4500 1 0 0 0 09 H

4501 0 1 0 1 05 H

4502 0 1 1 0 06 H

4503 1 0 1 0 0A H
EC6513- MICROPROCESSOR AND MICROCONTROLLER 52
LABORATORY

FLOWCHART:

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
MICROPROCESSOR AND MICROCONTROLLER 53
LABORATORY
PROGRAM FOR STEPPER MOTOR CONTOL;

ADDRESS OPCODE PROGRAM COMMENTS

Initialize memory location to store the


5000 MOV DX,FF26
array of number

5002 MOV AL,80 Initialize array size

5004 OUT DX,AL Copy the first data in AL

5006 MOV DX,FF20 Send it through port address

5007 MOV AL,05 Introduce delay

5009 OUT DX,AL Declare DX

500B CALL 5100 JUNP no zero

500E MOV AL,07 Increment DI

5010 OUT DX,AL Go to next memory location

Loop until all the data’s have been sent


5012 CALL 5100 Go to start location for continuous
rotation

5014 MOV AL,06 Array of data’s

5015 OUT DX,AL Output data from DX into AL

5017 CALL 5100 Call given address

5018 MOV AL,04 Move the data 04 to AL Register

501D OUT DX,AL Output data from DX into AL

501E CALL 5100 Call given address

5021 JMP 1006 Jump the program given address

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
DELAY SUBROTINE

ADDRESS OPCODE PROGRAM COMMENTS

Initialize memory location to store the


5100 MOVBX, 0010
array of number

5103 MOV AL,FF Initialize array size

5105 NOP No Operation

5106 NOP No Operation

5107 NOP No Operation

5108 NOP No Operation

5109 DEC AL Decrement AL

510B JNZ 5105 Jump no zero

510D DEC BX Decrement BX

510E JNZ 5103 Jump no zero

5110 RET Return main program

RESULT:

Thus the assembly language program for rotating stepper motor in both
clockwise and anticlockwise directions is written and verified.
MICROPROCESSOR AND MICROCONTROLLER 55
LABORATORY
EX. NO: 14

DATE :

INTERFACING PRGRAMMABLE KEYBOARD AND


DISPLAY CONTROLLER 8279

AIM :

To display a Character “ A” and also read a character using Keyboard and


Display Controller-8279

APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY

1. Microprocessor kit 8086 1


2. Power Supply +5 V, dc,+12 V dc 1
3. 8279- Interface board - 1

ALGORITHM :

➢ Display of a character “A“


➢ Set 8279 for 8 digit character display, right entry
➢ Set 8279 for clearing the display
➢ Write the command to display
➢ Load the character into accumulator and display it
MICROPROCESSOR AND MICROCONTROLLER 56
LABORATORY
PROGRAM: TO DISPLAY “A” IN 7 SEGMENT DISPLAY

MEMORY
LOCATION OPCODES LABEL PROGRAM COMMENDS

AL = 00 FOR 8 BIT
5000 C6,C0,00 MOV AL, 00 CHARACTER DISPLAY
LEFT ENTRY

E6,C2 I/O CONTROL WORD


5003 OUT C2, AL
ADDR C2 = AL
AL=CC FOR CLEAR
5005 C6,C0,CC MOV AL, CC DISPLAY

E6,C2 OUT C2, AL I/O CONTROL WORD


5008
ADDR C2 = AL
AL=90 FOR RAM
500A C6,C0,90 MOV AL, 90 ADDRESS & AUTO
INCREMENT

E6, C2 I/O CONTROL WORD


500D OUT C2, AL
ADDR C2 = AL

500F C6,C0,88 MOV AL, 88 AL= 88 CHARACTER “A”

5012 E6,C0 OUT C0, AL I/O DATA ADDR C0 = AL

5014 C6,C0,FF MOV AL,FF AL = FF CHARACTER “ “

5017 C7,C1,05,00 MOV CX, 0005 CX =0005 COUNTER

501B E6, C0 NEXT: OUT C0,AL I/O DATA ADDR C0 = AL

E2,FC JUMP ON CX NOT ZERO


501D LOOP NEXT
TO NEXT

501F F4 HLT HALT


MICROPROCESSOR AND MICROCONTROLLER 57
LABORATORY
FLOWCHART:

SEGMENT DEFINITION:
MICROPROCESSOR AND MICROCONTROLLER 58
LABORATORY

DATA BUS D7 D6 D5 D4 D3 D2 D1 D0

SEGMENTS D C B A DP G F A
MICROPROCESSOR AND MICROCONTROLLER 59
LABORATORY
MICROPROCESSOR AND MICROCONTROLLER 60
LABORATORY

PROGRAM: TO READ A CHARACTER USING 8279

MEMORY
LOCATION OPCODES LABEL PROGRAM COMMENDS

C7,C3,00,11 BX =5100 TO
5000 MOV BX,5100
STORE RESULT

E4,C2 AL = C2 ADDRESS I/O


5004 L1: IN AL, C2
ADDRESS
CHECK FOR A KEY
5006 F6,C0,07 TEST AL, 07 FROM STATUS WORD

5009 74,F9 JZ L1 JUMP ON ZERO TO L1


AL= 40 FIFO RAM
500B C6,C0,40 MOV AL,40 ADDRESS

E6,C2 C2 = AL ADDRESS I/O


500E OUT C2, AL
ADDRESS

5010 E4,C0 IN AL, C0 READ OF FIFO RAM C0

80,E0,0F AND WITH 0F TO GET


5012 AND AL,0F
CHARACTER

88,07 STORE THE RESULT IN


5015 MOV [BX],AL
1100 ADDRESS

5017 CD,02 INT 2 INTERRUPT

RESULT:

Thus the a character is displayed in 7 segment display and a pressed key is read &
store in memory using 8279 interface kit.
MICROPROCESSOR AND MICROCONTROLLER 61
LABORATORY
EX. NO: 15
DATE :
INTERFACING ANALOG TO DIGITAL CONVERTER USING 8086
AIM:

To write an assembly language program to convert analog signal into digital


signal using an ADC interfacing.

APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY


1. Microprocessor kit 8086 1
2. Power Supply +5 V dc,+12 V dc 1
3. ADC Interface board - 1

THEORY:

An ADC usually has two additional control lines: the SOC input to tell the
ADC when to start the conversion and the EOC output to announce when the
conversion is complete.

ALGORITHM:

➢ Select the channel and latch the address.


➢ Send the start conversion pulse.
➢ Read EOC signal.
➢ If EOC = 1 continue else go to step (iii)
➢ Read the digital output.
➢ Store it in a memory location.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
- MICROPROCESSOR AND MICROCONTROLLER 62
LABORATORY
PROGRAM:

MEMORY
OPCODES PROGRAM COMMENTS
LOCATION
Load accumulator
5000 MOV DX,FF26 with value for ALE
high
Send through output
5003 MOV AL,90
port
Load accumulator
5005 OUT DX,AL with value for ALE
low
Send through output
5006 MOV DX,FF24
port
Store the value to
5009 MOV AL,FF make SOC high in
the accumulator
Send through output
500B OUT DX,AL
port

500E MOV AL,00

5011 OUT DX,AL


Introduce delay
5013 MOV AL,FF

5016 OUT DX,AL

Store the value to


5018 CALL 5100 make SOC low the
accumulator
Send through output
501B MOV DX,FF20
port

IN AL,DX Read the EOC signal


501D from port & check
for end of conversion
501E INT 3
Stop the program

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
MICROPROCESSOR AND MICROCONTROLLER 63
LABORATORY
DELAY SUBROUTINE PROGRAM

Move the data 07ff to


5100 MOV CX,07FF
CX register

5103 NOP No operation

5104 NOP No operation

5105 DEC CX Decrement CX register

5106 JNZ 5103 Jump no zero

5108 RET Return to main address

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
FLOWCHART:
OUTPUT:

HEX CODE IN MEMORY DIGITAL DATA ON LED


ANALOG VOLTAGE
LOCATION DISPLAY

RESULT:

Thus the ADC was interfaced with 8086 and the given analog inputs were
converted into its digital equivalent.
EX. NO: 16
DATE :
INTERFACING DIGITAL – TO – ANALOG CONVERTER
USING 8086

AIM:

To convert digital inputs into analog outputs and to generate different


waveforms.

APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY

1. Microprocessor kit 8086 Vi Microsystems 1


2. Power Supply +5 V, dc,+12 V dc 1

3. DAC Interface board - 1

PROBLEM STATEMENT:

The program is executed for various digital values and equivalent analog
voltages are measured and also the waveforms are measured at the output ports
using CRO.

THEORY:

Since DAC 0800 is an 8 bit DAC and the output voltage variation is
between –5v and +5v. The output voltage varies in steps of 10/256 = 0.04
(approximately). The digital data input and the corresponding output voltages are
presented in the table. The basic idea behind the generation of waveforms is the
continuous generation of analog output of DAC. With 00 (Hex) as input to DAC2
the analog output is –5v. Similarly with FF H as input, the output is +5v. Outputting
digital data 00 and FF at regular intervals, to DAC2, results in a square wave of
amplitude 5v.Output digital data from 00 to FF in constant steps of 01 to DAC2.
Repeat this sequence again and again. As a result a saw-tooth wave will be
generated at DAC2 output. Output digital data from 00 to FF in constant steps of
01 to DAC2. Output digital data from FF to 00 in constant steps of 01 to DAC2.
FLOECHART
ALGORITHM

Measurement of analog voltage

(i) Send the digital value of DAC.


(ii) Read the corresponding analog value of its output.

Waveform generation

Square Waveform:

(i) Send low value (00) to the DAC.


(ii) Introduce suitable delay.
(iii) Send high value to DAC.
(iv) Introduce delay.
(v) Repeat the above
procedure. Saw-tooth waveform:
(i) Load low value (00) to accumulator.
(ii) Send this value to DAC.
(iii) Increment the accumulator.
(iv) Repeat step (ii) and (iii) until accumulator value reaches FF.
(v) Repeat the above procedure from step 1.
Triangular waveform:

(i) Load the low value (00) in accumulator.


(ii) Send this accumulator content to DAC.
(iii) Increment the accumulator.
(iv) Repeat step 2 and 3 until the accumulator reaches FF,
decrement the accumulator and send the accumulator contents
to DAC.

MEASUREMENT OF ANALOG VOLTAGE

DIGITAL DATA ANALOG VOLTAGE


PROGRAME FOR DAC

MEMORY
OPCODES PROGRAM COMMENTS
LOCATION
Load accumulator
5000 MOV DX,FF26 with value for ALE
high
Send through output
5003 MOV AL,80
port
Load accumulator
5005 OUT DX,AL with value for ALE
low
Send through output
5006 MOV DX,FF22
port
Store the value to
5009 MOV AL,FF make SOC high in
the accumulator
Send through output
500B OUT DX,AL
port

500E CALL 5100

5011 MOV AL,00


Introduce delay
5013 OUT DX,AL

5016 CALL 5100

Store the value to


5018 JMP 5009 make SOC low the
accumulator
DELAY SUOUTINEBR

Move the data 07ff to


5100 MOV CX,07FF
CX register

5103 NOP No operation

5104 NOP No operation

Decrement CX
5105 DEC CX
register

5106 JNZ 5103 Jump no zero

Return to main
5108 RET
address

RESULT
Thus the DAC was interfaced with 8086 and different waveforms have been
generated.
EX. NO: 17
DATE :
8 BIT ADDITION USING ARITHMETIC OPERATION 8051
MICROCONTROLLER
AIM:

To write an ALP program to add two 8-bit numbers using 8051


microcontroller.

ALGORITHM:

➢ Clear Program Status Word.


➢ Select Register bank by giving proper values to RS1 & RS0 of PSW.
➢ Load accumulator A with any desired 8-bit data.
➢ Load the register R 0 with the second 8- bit data.
➢ Add these two 8-bit numbers.
➢ Store the result.
➢ Stop the program.
FLOW CHART
PROGRAM

ADDRESS OPCODE MNEMONICS COMMENT

9000 74,02 MOV A,#02 MOVE THE


FIRST DATA
9002 78,04 MOV R0,#04 MOVE THE
SECOND DATA
9004 28 ADD A,R0 ADD THE
DATA
9005 12,00,03 LCALL 0003 LONG CALL;

OUTPUT:

INPUT OUTPUT

MEMORY MEMORY
DATA DATA

RESULT:

Thus the 8051 ALP for addition of two 8 bit numbers is executed.
EX. NO: 18
DATE :
8 BIT SUBTRACTION USING ARITHMETIC OPERATION
8051 MICROCONTROLLER

AIM:
To perform subtraction of two 8 bit data and store the result in memory.

ALGORITHM:
➢ Clear the carry flag.
➢ Initialize the register for borrow.
➢ Get the first operand into the accumulator.
➢ Subtract the second operand from the accumulator.
➢ If a borrow results increment the carry register.
➢ Store the result in memory.
FLOECHART:
8 BIT SUBTRACTION

ADDRESS OPCODE MNEMONICS COMMENT

9000 74,F4 MOV A,#F4 MOVE THE


FIRST DATA

9002 78,70 MOV R0,#70 MOVE THE


SECOND DATA

9004 98 SUBB A,R0 SUBTRACT


THE DATA

9005 12,00,03 LCALL 0003 LONG CALL

OUTPUT:

INPUT OUTPUT

Memory Memory
Data Data

RESULT:

Thus the 8051 ALP for subtraction of two 8 bit numbers is executed.
EX. NO: 19
DATE :
8 BIT MULTIPLICATION USING ARITHMETION OPERATION 8051
MICROCONTROLLER
AIM:

To perform multiplication of two 8 bit data and store the result in memory.

ALGORITHM:

➢ Get the multiplier in the accumulator.


➢ Get the multiplicand in the B register.
➢ Multiply A with B.
➢ Store the product in memory.
FLOWCHART:
8 BIT MULTIPLICATION

ADDRESS OPCODE MNEMONICS COMMENT

9000 74,50 MOV A,#50H MOVE THE


FIRST DATA

9002 75,F0,A0 MOV B,#A0H MOVE THE


SECOND DATA

9005 A4 MUL AB MULTIPLY THE


DATA

9006 12,00,03 LCALL 0003 STOP THE

PROGRAM
OUTPUT:

INPUT OUTPUT

Memory Memory
Data Data
Location location

4500 4502

4501 4503

RESULT:

Thus the 8051 ALP for multiplication of two 8 bit numbers is executed.
EX. NO: 20
DATE :
8 BIT DIVISION USING ARITHMETIC OPERATION 8051
MICROCONTROLLER
AIM:

To perform division of two 8 bit data and store the result in memory

ALGORITHM:

➢ Get the Dividend in the accumulator.


➢ Get the Divisor in the B register.
➢ Divide A by B.
➢ Store the Quotient and Remainder in memory.
FLOWCHART:
8 BIT DIVISION

ADDRESS OPCODE MNEMONICS COMMENT

9000 74,FB MOV A,#FB MOVE THE


FIRST DATA

9002 75,F0,12 MOV B,#12H MOVE THE


SECOND DATA

9005 84 DIV AB DIVIDE THE


DATA

9006 12,00,03 LCALL 0003 LONG CALL


EC6513- MICROPROCESSOR AND MICROCONTROLLER 84
LABORATORY
OUTPUT:

INPUT OUTPUT

Memory Memory
Data Data
Location location

4500 4502

4501 4503

RESULT:

Thus the 8051 ALP for division of two 8 bit numbers is executed.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
MICROPROCESSOR AND MICROCONTROLLER 85
LABORATORY
EX. NO: 21
DATE :
LOGICAL OPERATIONS USING
8051 MICROCONTROLLER

AIM:

To perform logical operation using 8051 microcontroller AND, OR & EX-OR.

ALGORITHM:

➢ Get the input value and store data in the accumulator.

➢ Get the second values and store the B register.

➢ Logical operation to perform the given number

➢ Store the output value in memory.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
PROGRAM FOR “AND” LOGIC

ADDRESS OPCODE MNEMONICS COMMENT


9000 74,02 MOV A,#02 MOVE THE
FIRST DATA
9002 78,02 MOV R0,#02 MOVE THE
SECOND DATA

9004 58 ANL A,R0 AND


OPERATION
9005 12,00,03 LCALL 0003 LONG CALL

PROGRAM FOR “OR” LOGIC

ADDRESS OPCODE MNEMONICS COMMENT


9000 74,02 MOV A,#02 MOVE THE
FIRST DATA
9002 78,02 MOV R0,#02 MOVE THE
SECOND DATA

9004 48 ORL A,R0 OR OPERATION

9005 12,00,03 LCALL 0003 LONG CALL


PROGRAM FOR “EX- OR” LOGIC

ADDRESS OPCODE MNEMONICS COMMENT

9000 74,02 MOV A,#02 MOVE THE


FIRST DATA
9002 78,02 MOV R0,#02 MOVE THE
SECOND DATA
9004 68 XRL A,R0 EX OR
OPERATION
9005 12,00,03 LCALL 0003 LONG CALL

OUTPUT:

GATE INPUT OUTPUT

AND

OR

EX-OR

RESULT:
Thus the assembly language program to perform logical operations AND, OR
& EX-OR using 8051 Performed and the result is stored.
EX. NO: 22
DATE :
FIND 2’S COMPLEMENT OF A NUMBER
AIM:

To Finding 2’s complement of a number using 8051 micro controller

RESOURCES REQUIERED:

➢ 8051 microcontroller kit


➢ Keyboard
➢ Power supply
PROGRAM:

ADDRESS OPCODE PROGRAM COMMENT

9100 74,01 MOV A,#01 MOVE THE


FIRST DATA
9102 F4 CPL A COMPLEMENT
A
9103 90,65,00 MOV DPTR,#6500 LOAD DATA
9016 F0 MOVX @DPTR,A MOVE A TO
DATA POINTER
9107 04 INC A INCREMENT
THE VALUE OF
A
9108 A3 INC DPTR INCREMENT
THE DATA
POINTER
9109 F0 MOVX @DPTR,A MOVE A TO
DATA POINTER
910A 12,00,03 LCALL LONG CALL

OUTPUT:

INPUT DATA OUTPUT DATA

RESULT;

Thus the program of finding 2’s complement of a number is done in 8051


microcontroller

You might also like