×

Close

Type:
**Practical**Institute:
**
ANNA UNIVERISTY
**Specialization:
**Information Technology Engineering**Offline Downloads:
**10**Views:
**232**Uploaded:
**4 months ago**

CS6412 – MICROPROCESSOR AND MICROCONTROLLER LAB
DEPT OF CSE
INDEX
EXPT.NO
NAME OF THE EXPERIMENT
PAGE
NO
3
1
Basic arithmetic and Logical operations
2
Move a Data Block Without Overlap
10
3
11
5
Code conversion, decimal arithmetic and Matrix
operations.
Floating point operations, string manipulations, sorting
and searching
Password Checking, Print Ram Size And System Date
6
Counters and Time Delay
36
7
Traffic light control
38
8
Stepper motor control
40
9
Digital clock
42
10
Key board and Display
45
11
Printer status
48
12
Serial interface and Parallel interface
49
13
A/D and D/A interface and Waveform Generation
53
14
Basic arithmetic and Logical operations
59
15
Square and Cube program, Find 2’s complement of a
number
Unpacked BCD to ASCII
70
4
16
17
31
72
2

CS6412 – MICROPROCESSOR AND MICROCONTROLLER LAB
DEPT OF CSE
BASIC ARITHMETIC AND LOGICAL OPERATIONS USING 8086
PROGRAMMING
EXPT NO: 01
DATE:
AIM:
To write an Assembly Language Program (ALP) for performing the Arithmetic
operation of two byte numbers.
APPARATUS REQUIRED:
SL.N
O
1.
2.
ITEM
Microprocessor kit
Power Supply
SPECIFICATION
8086 kit
+5 V dc
QUANTITY
1
1
PROBLEM STATEMENT:
Write an ALP in 8086 to add and subtract two byte numbers stored in the
memory location 1000H to 1003H and store the result in the memory location
1004H to 1005H.Also provide an instruction in the above program to consider the
carry also and store the carry in the memory location 1006H.
ALGORITHM:
(iii) Multiplication of 16-bit
(i) 16-bit addition
Initialize the MSBs of sum to 0
Get the first number.
Add the second number to the first
number.
If there is any carry, increment
MSBs of sum by 1.
Store LSBs of sum.
Store MSBs of sum.
(ii) 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.
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.
(iv) Division of 16-bit numbers.
Get the dividend
Get the divisor
Initialize the quotient to 0.
Dividend = dividend – divisor
If the divisor is greater, store the
quotient. Go to step g.
If dividend is greater, quotient
= quotient + 1. Repeat from
step (d)Store the dividend
value as remainder.
3

CS6412 – MICROPROCESSOR AND MICROCONTROLLER LAB
DEPT OF CSE
FLOWCHART
ADDITION
SUBTRACTION
START
START
SET UP COUNTER (CY)
SET UP COUNTER (CARRY)
GET FIRST OPERAND
GET FIRST
OPERAND TO A
GET SECOND OPERAND
TO
A
SUBTRACT
SECOND OPERAND
FROM MEMORY
YES
A=A+B
IS THERE
ANY CY
YES
NO
IS THERE
ANY CARRY
COUNTER =
COUNTER + 1
NO
STORE THE SUM
STORE THE CARRY
COUNTER =
COUNTER + 1
STORE THE
DIFFERENCE
STORE THE CARRY
STOP
STOP
4

CS6412 – MICROPROCESSOR AND MICROCONTROLLER LAB
ADDITION
ADDRESS
Opcodes
PROGRAM
DEPT OF CSE
COMMENTS
MOV CX, 0000H
Initialize counter CX
MOV AX,[1200]
Get the first data in AX reg
MOV BX, [1202]
Get the second data in BX reg
ADD AX,BX
Add the contents of both the
regs AX & BX
JNC L1
Check for carry
INC CX
If carry exists, increment the
CX
L1 : MOV [1206],CX
Store the carry
MOV [1204], AX
Store the sum
HLT
Stop the program
SUBTRACTION
ADDRESS
OPCODES
PROGRAM
COMMENTS
MOV CX, 0000H
Initialize counter CX
MOV AX,[1200]
Get the first data in AX reg
MOV BX, [1202]
Get the second data in BX reg
SUB AX,BX
Subtract the contents of BX from
AX
JNC L1
Check for borrow
INC CX
If borrow exists, increment the
CX
L1 : MOV [1206],CX
Store the borrow
MOV [1204], AX
Store the difference
HLT
Stop the program
5

## Leave your Comments