0% found this document useful (0 votes)
204 views

Microprocessor LAB

The document is a table of contents for experiments involving microprocessors and microcontrollers. It lists 16 experiments including programs using 8086 and 8051 microprocessors, peripherals and interfacing experiments, and serial/parallel interface experiments. The experiments involve arithmetic operations, block transfers, digital clocks, keyboard/display interfacing, and A/D and D/A conversion.

Uploaded by

Hari G
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
204 views

Microprocessor LAB

The document is a table of contents for experiments involving microprocessors and microcontrollers. It lists 16 experiments including programs using 8086 and 8051 microprocessors, peripherals and interfacing experiments, and serial/parallel interface experiments. The experiments involve arithmetic operations, block transfers, digital clocks, keyboard/display interfacing, and A/D and D/A conversion.

Uploaded by

Hari G
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 106

TABLE OF CONTENTS

Page Marks
Exp.No Date Name of Experiment Sign
no. Awarded
Page Marks
Exp.No Date Name of Experiment Sign
no. Awarded
EC8681 MICROPROCESSORS AND MICROCONTROLLERS
LABORATORY L T P C 0 0 4 2

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 controller
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
8051 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
PROGRAMS USING
8086 AND MASM
OUTPUT:. Basic Arithmetic and Logical Operations using 8086

ADDITION:

INPUT OUTPUT

MEMORY 1200 1201 1202 1203 1204 1205 1206 1207

DATA

SUBTRACTION:

INPUT OUTPUT
MEMORY 1200 1201 1202 1203 1204 1205 1206 1207
DATA

MULTIPLICATION:

INPUT OUTPUT

MEMORY 1200 1201 1202 1203 1204 1205 1206 1207

DATA

DIVISION:

INPUT OUTPUT

MEMORY 1200 1201 1202 1203 1204 1205 1206 1207


DATA
Ex.No.: 01
Date :
Basic Arithmetic and Logical Operations using 8086
AIM:
To write an Assembly Language Program (ALP) for performing the
addition,subtraction,multiplication and division operation of two byte
numbers.
APPARATUS REQUIRED:
SL.N ITEM SPECIFICATION QUANTITY
O
1. Microprocessor kit 8086 kit 1
2. Power Supply +5 V dc 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:
(i) 16-bit addition
h) Initialize the MSBs of sum to 0
i) Get the first number.
j) Add the second number to the first number.
k) If there is any carry, increment MSBs of sum by 1.
l) Store LSBs of sum.
m) Store MSBs of sum.

(ii) 16-bit subtraction


f) Initialize the MSBs of difference to 0
g) Get the first number
h) Subtract the second number from the first number.
i) If there is any borrow, increment MSBs of difference by 1.
j) Store LSBs of difference
k) Store MSBs of difference.
ALGORITHM:
(i) Multiplication of 16-bit numbers:
a) Get the multiplier.
b) Get the multiplicand
c) Initialize the product to 0.
d) Product = product + multiplicand
e) Decrement the multiplier by 1
f) If multiplicand is not equal to 0,repeat from step (d) otherwise store the
product.

3
(ii) Division of 16-bit numbers.
a) Get the dividend
b) Get the divisor
c) Initialize the quotient to 0.
d) Dividend = dividend –divisor
e) If the divisor is greater, store the quotient. Go to step g.
f) If dividend is greater, quotient = quotient + 1. Repeat from step (d)
Store the dividend value as remainder.

PROGRAM: 16 BIT ADDITION

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

1000 MOV CX, 0000H E7C10000 Initialize counter CX

Get the first data in AX reg


1004 MOV AX,[1200] 8B060012

Get the second data in BX reg


1008 MOV BX, [1202] 8B1E0212

01D8 Add the contents of both the


100C
ADD AX,BX regs AX & BX

100E 7301 Check for


JNC L1 carry

1010 41 If carry exists, increment the


INC CX CX
L1 :
1011 890E0612
MOV [1206],CX Store the carry

1015 89060412
MOV [1204], AX Store the sum

1019 F4 Stop the


HLT program

4
PROGRAM: 16 BIT SUBTRACTION

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

1000 MOV CX, 0000H C7C10000 Initialize counter CX

Get the first data in AX reg


1004 MOV AX,[1200] 8B060012

Get the second data in BX reg


1008 MOV BX, [1202] 8B1E0212

29D8 Add the contents of both the


100C
SUB AX,BX regs AX & BX

100E 7301 Check for


JNC L1 carry

1010 41 If carry exists, increment the


INC CX CX
L1 :
1011 890E0612
MOV [1206],CX Store the carry

1015 89060412
MOV [1204], AX Store the sum

1019 F4 Stop the


HLT program

5
PROGRAM: 16 BIT MULTIPLICATION

ADDRES LABEL MNEMONICS OPCODE COMMENTS


S
1000 MOV AX,[1200] 8B060012 Get the first data

1004 MOV BX, [1202] 8B1E0212 Get the second data

1008 MUL BX F7E3 Multiply both

Store the lower order


100A 89060612
MOV [1204],AX product

Copy the
100E 89D8 higher order
product to
MOV AX,DX AX

Store the
1010 89060812
MOV [1206],AX higher order
product
1014 HLT F4 Stop the program

PROGRAM: 16 BIT DEVISION

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

1000 MOV AX,[1200] 8B060012 Get the first data

1004 MOV BX, [1202] 8B1E0212 Get the second data

1008 DIV BX F7F3 Multiply both

100A MOV [1204],AX 89060412 Store the lower order product

Copy the
100E 89D8
higher order
MOV AX,DX product to AX

Store the
1010 89060812
MOV [1206],AX higher order
product
1014 F4
HLT Stop the program

6
RESULT:
Thus the Assembly Language Program for basic arithmetic and logical operations has been
performed and the result was stored.

7
OUTPUT: Block Transfer without Overlap

INPUT:

OUTPUT:

8
Ex.No.: 02
Date :
Block Transfer without Overlap
AIM :

To write an Assembly Language Program (ALP) for moving a data block without overlap using
8086.
APPARATUS REQUIRED:
8086 kit
PROGRAM: (MOVING A DATA BLOCK USING 8086 kit)

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

1000 MOV SI,1100h C7C60011

1004 MOV DI,1200h C7C70012

1008 MOV CX,05h C7C10500

100C MOV AX,[SI] 8B05


L1:

100E MOV [DI],AX 8905

1010 INC SI 46

1011 INC SI 46

1012 INC DI 47

1013 INC DI 47

1014 LOOP L1 E2F6

1016 HLT F4

RESULT:
Thus the Assembly Language Program for moving a data block without overlap has
been performed and the result is stored.

9
OUTPUT:

A) ASCII NUMBER TO DECIMAL

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

1200 1201

B) output: hex (FFFF) number into its equivalent decimal value


OUTPUT:

10
Ex.No.: 03(A)
Date :

CODE CONVERSION

AIM:
To Convert
a. ASCII Number to Decimal
b. hex (FFFF) number into its equivalent decimal value and stored at consecutive memory
locations.

APPARATUS REQUIRED:
8086 kit
PROGRAM

ASCII NUMBER TO DECIMAL

Address Opcode Label Mnemonics Comments


MOV SI,1200H address 1200 load
1000 C7C60012
in SI
MOV AL,[SI] Content of memory
1004 8A 04
To AL
1006 80E830 SUB AL,30H

1009 CMP AL,0AH


80580A

100C 72 FF JC L1

100E C6C0FF MOV AL,0FFH

1012 L1 INC SI
8804

1014 MOV [SI],AL


F4

1010 HLT
F4

11
hex (FFFF) number into its equivalent decimal
Address Label Mnemonics opcode Comments
MOV
1000 AX,0FFFFh C7C0FFFF

04 MOV DX,0h
C7C20000
MOV
1008 CX,2710H C7C11027

DIV CX
100C F7F1
AND AX,00FFh
100E 81E0FF00
MOV SI,1200h
1012 C7C60012
MOV [SI],AL
1016 8804
MOV AX,DX
1018 89D0
MOV DX,0h
101A C7C20000
MOV
101E CX,03E8H
C7C13E00
DIV CX
1022 F7F1
AND AX,00FFh
1026 81E0FF00

1028 INC SI 46
MOV [SI],AL
1029 8804
MOV AX,DX
102B 89D0

102D MOV BL,64H C6C364


DIV BL
1030 F6F3

1032 INC SI 46

1033 MOV [SI],AL 8804


AND
1035 AX,0FF00h 81E000FF

MOV AL,AH
1039 88E0
MOV AH,0h
3B C6C400

103E MOV BL,0AH C6C30 A

12
DIV BL
1041 F6F3

1043 INC SI 46
MOV [SI],AL
1044 8804
INC SI
1046 46
MOV [SI],AH
1047 8824
HLT F4
1049

RESULT:

Thus the Convert ASCII Number to Decimal and Hex to Binary performed using 8086. hex
(FFFF) number into its equivalent decimal value and stored at consecutive memory locations.

13
OUTPUT: Decimal
Addition INPUT
1100 :
1101 :
OUTPUT
1102 :

OUTPUT: Decimal Subtraction

INPUT
1100 :
1101 :
OUTPUT
1102 :

14
Ex.No.: 03 (B)
Date :
DECIMAL ARITHMATIC OPERATIONS
AIM:
To perform a addition and subtracton operations between two decimal numbers.
THEORY:

Get the two numbers from mentioned address using MOV instruction.After that add two valuesand
display the result will be decimal value using DAA (DECIMAL ADJUST ADDITION) instruction.

Get the two numbers from mentioned address using MOV instruction .After that subtract the second
byte from first byte using SUB instruction and display the result will be decimal value using DAS
(DECIMAL ADJUST SUBTRACTION) instruction.
ADDITION:
Address Label Mnemonics opcode Comments

1000 MOV SI,1100h


C7C60011
MOV AL,[SI]
1004 8A04

1006 INC SI 46

1007 MOV BL,[SI] 8A1C

1009 ADD AL,BL 00D8

100B DAA 27

100C INC SI 46

100D MOV [SI],AL 8804

100F HLT F4

15
SUBTRACTION

Address Label Mnemonics Opcode Comments

1000 MOV SI,1100h


C7C60011
MOV AL,[SI]
1004 8A04

1006 INC SI 46

1007 MOV BL,[SI] 8A1C

1009 SUB AL,BL 28D8

100B DAS 2F

C INC SI 46

100D MOV [SI],AL 8804

100F HLT F4

16
RESULT:

Thus the addition and subtraction operation between decimal numbers has been executed and
stored at consecutive memory locations.

17
OUTPUT:MATRIX ADDITION
INPUT

INPUT

OUTPUT

OUTPUT: MATRIX SUBTRACTION


INPUT

INPUT

OUTPUT

18
Ex.No.: 03(C)
Date :

MATRIX OPERATION
AIM:

To Write ALP for Matrix Addition and subtraction and result stored at consecutive memory
locations.

APPARATUS REQUIRED:
8086 kit
PROGRAM

MATRIX ADDITION

Address Label Mnemonic Opcode Comments


1000 MOV CL,09 C6C109
MOV
1003 C7C60011
SI,1100h
1007 MOV DI,1150h C7C75011

100B MOV AL,[SI] 8A0A

100D MOV BL,[DI] 8A1D


ADD AL,BL 00DB
100F
8805
1011 MOV [DI],AL

L1: 47
1013 INC DI
46
1014 INC SI

1015 DEC CL FEC9

1017 JNZ L1 75F2

1019 HLT F4

19
Matrix subtraction

Address Label Mnemonic Opcode Comments


1000 MOV CL,09 C6C109

1003 MOV SI,1100h C7C60011

1007 MOV DI,1150h C7C75011

100B MOV AL,[SI] 8A04

100D MOV BL,[DI] 8A1D


SUB AL,BL
100F 28D8

1011 MOV [DI],AL 8805

L1:
1013 INC DI 47

1014 INC SI 46

1015 DEC CL FEC9

1017 JNZ L1 75FA

1019 HLT F4

20
RESULT:
Thus the Matrix Addition and subtraction is performed using 8086.

21
a) OUTPUT: COPYING
A STRING

INPUT

MEMORY 1200 1201 1202 1203 1204

DATA

OUTPUT

MEMORY
1300 1301 1302 1303 1304

DATA

22
Ex.No.: 04(A)
Date :
FLOATING POINT OPERATIONS, STRING MANIPULATIONS,
SORTING AND SEARCHING

A) COPYING A STRING
AIM:
To move a string of length FF from source to destination.

ALGORITHM:
a. Initialize the data segment .(DS)
b. Initialize the extra data segment .(ES)
c. Initialize the start of string in the DS. (SI)
d. Initialize the start of string in the ES. (DI)
e. Move the length of the string(FF) in CX register.
Move the byte from DS TO
ES, till CX=0.

A)COPYING A STRING
ADDRESS OPCODES PROGRAM COMMENTS

MOV SI,1200H Initialize destination address


1000 C7C60012
1004 C7C70013 MOV DI,1300H Initialize starting address

1008 C7C10600 MOV CX,0006H Initialize array size

100C FC CLD Clear direction flag

100D F3A4 REP MOVSB Copy the contents of source into


destination until count reaches zero
100F F4 HLT Stop

RESULT:

Thus a string of a particular length is moved from source segment to destination segment.

23
OUTPUT: SEARCHING
A STRING

INPUT

MEMORY
1300 1301 1302 1303 1304
DATA

OUTPUT

MEMORY LOCATION 1400(1302)

DATA

24
Ex.no:4B
Date :

B) SEARCHING A STRING
AIM:
To scan for a given byte in the string and find the relative address of the byte from
the starting location of the string.

ALGORITHM:
a. Initialize the extra segment .(ES)
b. Initialize the start of string in the ES. (DI)
c. Move the number of elements in the string in CX register.
d. Move the byte to be searched in the AL register.
Scan for the byte in ES. If the byte is found ZF=0, move the
address pointed by ES:DI to BX.

SEARCHING FOR A CHARACTER IN THE STRING


ADDRESS OPCODES PROGRAM COMMENTS

4000 C7C70013 MOV DI,1300H Initialize destination address

4004 C7C60014 MOV SI, 1400H Initialize starting address

4008 C7C10600 MOV CX, 0006H Initialize array size

400C FC CLD Clear direction flag

400D C6C008 MOV AL, 08H Store the string to be searched

4010 F2AE REPNE SCASB Scan until the string is found

4012 4F DEC DI Decrement the destination address

4013 8A1D MOV BL,[DI] Store the contents into BL reg

4015 881C MOV [SI],BL Store content of BL in source address

4017 F4 HLT Stop

RESULT:
Thus a given byte or word in a string of a particular length in the extra
segment(destination) is found .

25
OUTPUT:.
ASCENDING

INPUT OUTPUT
MEMORY

DATA

DESCENDING

INPUT OUTPUT
MEMORY

DATA

26
Ex.No.: 04(C)
Date :

ASCENDING & DESCENDING

AIM:
To write an Assembly Language Program (ALP) to sort a given array
in ascending and descending order.

APPARATUS REQUIRED:

SL.N ITEM SPECIFICATION QUANTITY


O
1. Microprocessor kit 8086 1
2. Power Supply +5 V dc 1

PROBLEM STATEMENT:

An array of length 10 is given from the location. Sort it into


descending and ascending order and store the result.

ALGORITHM:
(i) Sorting in ascending order:
a. Load the array count in two registers C1 and C2.
b. Get the first two numbers.
c. Compare the numbers and exchange if necessary so that the two numbers are
in ascending order.
d. Decrement C2.
e. Get the third number from the array and repeat the process until C2 is 0.
f. Decrement C1 and repeat the process until C1 is 0.
(ii) Sorting in descending order:
a. Load the array count in two registers C1 and C2.
b. Get the first two numbers.
c. Compare the numbers and exchange if necessary so that the two numbers are
in descending order.
d. Decrement C2.
e. Get the third number from the array and repeat the process until C2 is 0.
f. Decrement C1 and repeat the process until C1 is 0.

27
ASCENDING:

ADDRESS OPCODES PROGRAM COMMENTS


1000 C7C60012 MOV SI,1200H Initialize memory location for array size
1004 8A0C MOV CL,[SI] Number of comparisons in CL
1006 C7C60012 L4 : MOV SI,1200H Initialize memory location for array size
100A 8A14 MOV DL,[SI] Get the count in DL
100C 46 INC SI Go to next memory location
100D 8A04 MOV AL,[SI] Get the first data in AL
100F 46 L3 : INC SI Go to next memory location
1010 8A1C MOV BL,[SI] Get the second data in BL
1012 38D8 CMP AL,BL Compare Two da
1014 7308 JNB L1 If AL < BL go to L1
1016 4E DEC SI Else, Decrement the memory location
1017 8804 MOV [SI],AL Store the smallest data
1019 88D8 MOV AL,BL Get the next data AL
101B E90300 JMP L2 Jump to L2
101E 4E L1 : DEC SI Decrement the memory location
101F MOV [SI],BL Store the greatest data in memory
881C location
1021 46 L2 : INC SI Go to next memory location
1022 FECA DEC DL Decrement the count
1024 JNZ L3 Jump to L3, if the count is not reached
75E9 zero
1026 8804 MOV [SI],AL Store data in memory location
1028 FEC9 DEC CL Decrement the count
102A 75DA JNZ L4 Jump to L4, if the count is not reached
zero
102C F4 HLT Stop

28
DESCENDING

ADDRESS OPCODES PROGRAM COMMENTS


1000 C7C60012 MOV SI,1200H Initialize memory location for array size
1004 8A0C MOV CL,[SI] Number of comparisons in CL
1006 C7C60012 L4 : MOV SI,1200H Initialize memory location for array size
100A 8A14 MOV DL,[SI] Get the count in DL
100C 46 INC SI Go to next memory location
100D 8404 MOV AL,[SI] Get the first data in AL
100F 46 L3 : INC SI Go to next memory location
1010 8A1C MOV BL,[SI] Get the second data in BL
1012 38D8 CMP AL,BL Compare two d
1014 7208 JB L1 If AL > BL go to L1
1016 4E DEC SI Else, Decrement the memory location
1017 8804 MOV [SI],AL Store the largest data
1019 88D8 MOV AL,BL Get the next data AL
101B E90300 JMP L2 Jump to L2
101E 4E L1 : DEC SI Decrement the memory location
101F 881C MOV [SI],BL Store the smallest data in memory
location
1021 46 L2 : INC SI Go to next memory location
1022 FCEA DEC DL Decrement the count
1024 75E9 JNZ L3 Jump to L3, if the count is not reached
zero
1026 8804 MOV [SI],AL Store data in memory location
1028 FEC9 DEC CL Decrement the count
102A 75DA JNZ L4 Jump to L4, if the count is not reached
zero
102C FL HLT Stop

RESULT:

Thus given array of numbers are sorted in ascending & descending order.

29
OUTPUT:.
LARGEST

INPUT OUTPUT

MEMORY

DATA

SMALLEST

INPUT OUTPUT
MEMORY

DATA

30
Ex.No.: 04(D)
Date :

LARGEST& SMALLEST

AIM:
To write an Assembly Language Program (ALP) to find the
largest and smallest number in a given array.

APPARATUS REQUIRED:

SL.N ITEM SPECIFICATION QUANTITY


O
1. Microprocessor kit 8086 1
2. Power Supply +5 V dc 1

PROBLEM STATEMENT:

An array of length 10 is given from the location. Find the largest


and smallest number and store the result.

ALGORITHM:
(i) Finding largest number:
a. Load the array count in a register
C1. b. Get the first two numbers.
c. Compare the numbers and exchange if the number is small.
d. Get the third number from the array and repeat the process until C1 is 0.

(ii) Finding smallest number:


e. Load the array count in a register C1.
f. Get the first two numbers.
g. Compare the numbers and exchange if the number is large.
h. Get the third number from the array and repeat the process until C1 is 0.

31
LARGEST

ADDRESS OPCODES PROGRAM COMMENTS

1000 C7C60012 MOV SI,1200H Initialize array size


1004 8A0C MOV CL,[SI] Initialize the count
1006 46 INC SI Go to next memory location
Move the first data in
1007 8A04 MOV AL,[SI] AL
1009 FEC9 DEC CL Reduce the count
100B
46 L2 : INC SI Move the SI pointer to next data
100C 3A04 CMP AL,[SI] Compare stwo D
100E 7302 JNB L1 If AL > [SI] then go to L1 ( no swap)
1010 8A04 MOV AL,[SI] Else move the large number to AL
1012 FEC9 L1 : DEC CL Decrement the count
1014 75F5 JNZ L2 If count is not zero go to L2
Initialize DI with
1016 C7C70013 MOV DI,1300H 1300H
1018 8805 MOV [DI],AL Else store the biggest number in 1300
location
101C F4 HLT Stop

SMALLEST

ADDRESS OPCODES PROGRAM COMMENTS

1000 C7C60012 MOV SI,1200H Initialize array size


1004 8A0C MOV CL,[SI] Initialize the count
1006 46 INC SI Go to next memory location
Move the first data in
1007 8A04 MOV AL,[SI] AL
1009 FEC9 DEC CL Reduce the count
100B 46 L2 : INC SI Move the SI pointer to next data
100C 3A04 CMP AL,[SI] Compare two D
100E 7202 JB L1 If AL < [SI] then go to L1 ( no swap)
1010 8A04 MOV AL,[SI] Else move the large number to AL
1012 FEC9 L1 : DEC CL Decrement the count
1014 75F2 JNZ L2 If count is not zero go to L2
Initialize DI with
1016 C7C70013 MOV DI,1300H 1300H
101A 8805 MOV [DI],AL Else store the biggest number in 1300
location
101C F4 HLT Stop

32
RESULT:
Thus largest and smallest number is found in a given array.

33
A. OUTPUT: PASSWORD CHECKING
password set input :

After executing type the password via keyboard and press enter button the lcd
show the output.

34
Ex.No.: 05(A)
Date : PASSWORD CHECKING

AIM:
To check whether the password is correct or not.

THEORY:
Steps to be followed
i)initialization of lcd
ii)display “ENTER PASSWORD”
iii)store the password key value
iv)get the key value from keyboard and compare to it stored value
v)if password matched display” PASSWORD OK”
vi) if password mismatched display ” PASSWOR
vii)clear the key value to be stored
CPLD ADDRESSES TO BE USED:
LCD DATA/COMMAND :04H
RS :06H
KEYBOARD :02H
CODE:
0000 code segment
assume cs:code,ds:code
1000 org 1000h
1000 E8 1105 R CALL L10
1003 E8 110C R CALL L11
1006 B0 38 MOV AL,38h
1008 E6 04 OUT 04h,AL
100A E8 1105 R CALL L10
100D E8 110C R CALL L11
1010 B0 0E MOV AL,0Eh
1012 E6 04 OUT 04h,AL
1014 E8 1105 R CALL L10
1017 E8 110C R CALL L11
101A B0 01 MOV AL,01h
101C E6 04 OUT 04h,AL
101E E8 1105 R CALL L10
1021 E8 110C R CALL L11
1024 B0 06 MOV AL,06h
1026 E6 04 OUT 04h,AL
1028 E8 1105 R CALL L10
102B E8 110C R CALL L11
102E B0 80 MOV AL,80h
1030 E6 04 OUT 04h,AL
1032 E8 1105 R CALL L10
1035 E8 110C R CALL L11
1038 B0 0C MOV AL,0Ch
103A E6 04 OUT 04h,AL
103C B1 10 MOV CL,10h
103E BE 111C R MOV SI,offset mess
1041 E8 1105 R L7 CALL L10
1044 E8 1111 R CALL L12

35
1047 8A 04 MOV AL,[SI]
1049 E6 04 OUT 04h,AL
104B FE C9 DEC CL
104D 83 C6 01 ADD SI,01h
1050 8A C1 MOV AL,CL
1052 2C 01 SUB AL,01h
1054 75 EB JNZ L7
1056 E8 1105 R CALL L10
1059 E8 110C R CALL L11
105C B0 C4 MOV AL,0C4h
105E E6 04 OUT 04h,AL
1060 BF 1220 MOV DI,1220h
1063 E4 02 L6: IN AL,02h
1065 24 FF AND AL,0FFh
1067 3C F0 CMP AL,0F0h
1069 75 F8 JNZ L6
106B E8 1116 R CALL L13
106E E4 02 IN AL,02h
1070 24 FF AND AL,0FFh
1072 3C 5A CMP AL,5Ah
1074 74 11 JZ LA
1076 88 05 MOV [DI],AL
1078 83 C7 01 ADD DI,01h
107B E8 1105 R CALL L10
107E E8 1111 R CALL L12
1081 B0 2A MOV AL,2Ah
1083 E6 04 OUT 04h,AL
1085 EB DC JMP L6
1087 BE 1240 LA: MOV SI,1240h
108A BF 1220 MOV DI,1220h
108D B7 06 MOV BH,06h
108F FE CF L5: DEC BH
1091 8A C7 MOV AL,BH
1093 0C 00 OR AL,00h
1095 74 33 JZ LF
1097 8A 04 MOV AL,[SI]
1099 8A 1D MOV BL,[DI]
109B 83 C6 01 ADD SI,01h
109E 83 C7 01 ADD DI,01h
10A1 3A C3 CMP AL,BL
10A3 74 EA JZ L5
10A5 E8 1105 R CALL L10
10A8 E8 110C R CALL L11
10AB B0 C0 MOV AL,0C0h
10AD E6 04 OUT 04h,AL
10AF B1 0F MOV CL,0Fh
10B1 BE 1137 R MOV SI,offset mess2
10B4 E8 1105 R L4: CALL L10
10B7 E8 1111 R CALL L12

36
10BA 8A 04 MOV AL,[SI]
10BC E6 04 OUT 04h,AL
10BE FE C9 DEC CL
10C0 83 C6 01 ADD SI,01h
10C3 8A C1 MOV AL,CL
10C5 0C 00 OR AL,00h
10C7 75 EB JNZ L4
10C9 F4 HLT
10CA E8 10CD R LF: CALL L14
10CD L14:
10CD E8 1105 R CALL L10
10D0 E8 110C R CALL L11
10D3 B0 C0 MOV AL,0C0h
10D5 E6 04 OUT 04h,AL
10D7 B1 0C MOV CL,0Ch
10D9 BE 112B R MOV SI,offset mess1
10DC E8 1105 R L2: CALL L10
10DF E8 1111 R CALL l12
10E2 8A 04 MOV AL,[SI]
10E4 E6 04 OUT 04h,AL
10E6 FE C9 DEC CL
10E8 83 C6 01 ADD SI,01h
10EB 8A C1 MOV AL,CL
10ED 0C 00 OR AL,00h
10EF 75 EB JNZ L2
10F1 BE 1220 MOV SI,1220h
10F4 B1 05 MOV CL,05h
10F6 B0 00 L1: MOV AL,00h
10F8 8804 MOV [SI],AL
10FA 83 C6 01 ADD SI,01h
10FD FE C9 DEC CL
10FF 8AC1 MOV AL,CL
1101 0C 00 OR AL,00h
1103 75 F1 JNZ L1
1105 L10 :
1105 B0 4F MOV AL,4Fh
1107 2C 01 L3: SUB AL,01h
1109 75 FC JNZ L3
110B C3 RET
110C L11:
110C B000 MOV AL,00h
110E E6 06 OUT 06h,AL
1110 C3 RET
1111 L12:
1111 B0 01 MOV AL,01h
1113 E6 06 OUT 06h,AL
1115 C3 RET
1116 L13:
1116 B9 0FFF MOV CX,0FFFh
1119 E2 FE HE: LOOP HE
111B C3 RET

37
111C 20 45 4E 54 45 52 mess db " ENTER PASSWORD" 20
50 41 53 53 57
4F 52 44
112B 50 41 53 53 57 4F mess1 db "PASSWORD OK "
52 44 20 4F 4B 20
1137 50 41 53 53 57 4F mess2 db "PASSWORD NOT OK"
52 44 20 4E 4F 54
20 4F 4B
1146 code ends
End

38
RESULT:
Thus the password has entered and verified.

39
B. OUTPUT: Print RAM size

40
Ex.No.: 05(B)
Date :
DISPLAY RAM SIZE
AIM:
To find display the RAM SIZE of the system.
THEORY:
Steps to be followed in program
i) fill the memory with data in RAM
ii) check how much memory correctly filled with data
iii) initialization of lcd
iv) display “RAM SIZE”
v) Read the count value and display the count value as RAM
size. CPLD ADDRESSES TO BE USED:
LCD DATA/COMMAND :04H
RS :06H
CODE:
0000 code segment
assume cs:code,ds:code
1000 org 1000h
1000 BE 0000 MOV SI,0000h
1003 B9 1000 MOV CX,1000h
1006 B0 11 L1: MOV AL,11h
1008 88 04 MOV [SI],AL
100A 46 INC SI
100B E2 F9 LOOP L1
100D BE 2000 MOV SI,2000h
1010 BA 1FFF MOV DX,1FFFh
1013 B9 7FFF MOV CX,7FFFh
1016 B0 44 L3: MOV AL,44h
1018 88 04 MOV [SI],AL
101A 8A 1C MOV BL,[SI]
101C 46 INC SI
101C CMP AL,BL
101F 75 07 JNZ L2

41
1021 83 C2 01 ADD DX,01h
1024 E2 F0 LOOP L3
1026 F4 HLT
1027 90 NOP
1028 L2:
1028 E8 10D1 R CALL L10
102B E8 10D8 R CALL L11
102E B0 38 MOV AL,38h
1030 E6 04 OUT 04h,AL
1032 E8 10D1 R CALL L10
1035 E8 10D8 R CALL L11
1038 B0 0E MOV AL,0Eh
103A E6 04 OUT 04h,AL
103C E8 10D1 R CALL L10
103F E8 10D8 R CALL L11
1042 B0 01 MOV AL,01h
1044 E6 04 OUT 04h,AL
1046 E8 10D1 R CALL L10
1049 E8 10D8 R CALL L11
104C B0 06 MOV AL,06h
104E E6 04 OUT 04h,AL
1050 E8 10D1 R CALL L10
CALL L11
1056 B0 80 MOV AL,80h
1058 E6 04 OUT 04h,AL
105A E8 10D1 R CALL L10
105D E8 10D8 R CALL L11
1060 B0 0C MOV AL,0Ch
1062 E6 04 OUT 04h,AL
1064 E8 10D1 R CALL L10
1067 B1 0C MOV CL,0ch
1069 BE 10E2 R MOV SI,offset mess
106C E8 10D1 R L4: CALL L10
106F E8 10DD R CALL L12
1072 8A 04 MOV AL,[SI]

42
1074 E6 04 OUT 04h,AL
076 FE C9 DEC CL
1078 46 INC SI
1079 8A C1 MOV AL,CL
107B 0C 00 OR AL,00h
107D 75 ED JNZ L4
107F E8 10D1 R CALL L10
1082 E8 10DD R CALL L12
1085 8B C2 MOV AX,DX
1087 BA 0000 MOV DX,0
108A B9 03FF MOV CX,03FFH
108D F7 F1 DIV CX
108F B3 0A MOV BL,0AH
1091 F6 F3 DIV BL
1093 8A D0 MOV DL,AL
1095 8A F4 MOV DH,AH
1097 E8 10D1 R CALL L10
109A E8 10D8 R CALL L11
109D B0 C4 MOV AL,0C4h
109F E6 04 OUT 04h,AL
10A1 E8 10D1 R CALL L10
10A4 E8 10DD R CALL L12
10A7 8A C2 MOV AL,DL
10A9 04 30 add AL,30h
10AB E6 04 OUT 04h,AL
10AD E8 10D1 R CALL L10
10B0 E8 10DD R CALL L12
10B3 8A C6 MOV AL,DH
10B5 04 30 ADD AL,30h
10B7 E6 04 OUT 04h,AL
10B9 E8 10D1 R CALL L10
10BC E8 10DD R CALL L12
10BF B0 6B MOV AL,6Bh
10C1 E6 04 OUT 04h,AL
10C3 E8 10D1 R CALL L10

43
10C6 E8 10DD R CALL L12
10C9 B0 42 MOV AL,42h
10CB E6 04 OUT 04h,AL
10CD E8 10D1 R CALL L10
10D0 F4 HLT
10D1 L10:
10D1 B0 7F MOV AL,7Fh
10D3 2C 01 L8: SUB AL,01h
10D5 75 FC JNZ L8
10D7 C3 RET
10D8 L11:
10D8 B0 00 MOV AL,00h
10DA E6 06 OUT 06h,AL
10DC` E C3 RET
10DD L12:
10DD B0 01 MOV AL,01h
10DF E6 06 OUT 06h,AL
10E1 C3 RET

10E2 20 52 41 4D 20 53 mess db " RAM SIZE IS"


49 5A 45 20 49 53
10EE code
ends End

44
RESULT:
Thus the find display the RAM SIZE of the system has executed and verified.

45
C. OUTPUT: SYSTEM DATE
INPUT:

46
Ex.No.: 05(C)
Date :
SYSTEM DATE
AIM:
To display the date using microprocessor.
THEORY:
Interfacing VBMB-15 to 8086
Steps to be followed in program
i) set 24 hours format
ii) set time(23:55:55)
iii) set date(dd:mm:yy)
iv) read time &date
CODE:
0000 code segment
assume cs:code,ds:code
1000 org 1000h
1000 B0 05 MOV AL,05H
1002 E6 DE OUT 0DEH,AL
1004 B0 04 MOV AL,04H
1006 E6 DE OUT 0DEH,AL
1008 BE 1200 MOV SI,1200H
100B 8A 04 MOV AL,[SI]
100D E6 C0 OUT 0C0H,AL
100F 46 INC SI
1010 8A 04 MOV AL,[SI]
1012 E6 D0 OUT 0D0H,AL
1014 46 INC SI
1015 8A 04 MOV AL,[SI]
1017 E6 C2 OUT 0C2H,AL
1019 46 INC SI
101A 8A 04 MOV AL,[SI]
101C E6 D2 OUT 0D2H,AL
101E 46 INC SI
101F 8A 04 MOV AL,[SI]

47
1021 E6 C4 OUT 0C4H,AL
1023 46 INC SI
1024 8A 04 MOV AL,[SI]
1026 E6 D4 OUT 0D4H,AL
1028 46 INC SI
1029 8A 04 MOV AL,[SI]
102B E6 C6 OUT 0C6H,AL
102D 46 I NC SI
102E 8A04 MOV AL,[SI]
1030 E6 D6 OUT 0D6H,AL
1032 46 INC SI
1033 8A 04 MOV AL,[SI]
1035 E6 C8 OUT 0C8H,AL
1037 46 INC SI
1038 8A04 MOV AL,[SI]
103A E6 D8 OUT 0D8H,AL
103C 46 INC SI
103D 8A04 MOV AL,[SI]
103F E6 CA OUT 0CAH,AL
1041 46 INC SI
1042 8A04 MOV AL,[SI]
1044 E6 DA OUT 0DAH,AL
1046 BE 1300 LOOP: MOV SI,1300H
1049 E4 D6 IN AL,0D6H
104B 24 0F AND AL,0FH
104D 88 04 MOV [SI],AL
104F E4 C6 IN AL,0C6H
1051 24 0F AND AL,0FH
1053 46 INC SI
1054 88 04 MOV [SI],AL
1056 E4 D8 IN AL,0D8H
1058 24 0F AND AL,0FH
105A 46 INC SI
105B 8804 MOV [SI],AL
105D E4C8 IN AL,0C8H

48
105F 24 0F AND AL,0FH
1061 46 INC SI
1062 8804 MOV [SI],AL
1064 E4 DA IN AL,0DAH
1066 24 0F AND AL,0FH
1068 46 INC SI
1069 88 04 MOV [SI],AL
106B E4 CA IN AL,0CAH
106D 24 0F AND AL,0FH
106F 46 INC SI
1070 8804 MOV [SI],AL
1072 BE 1300 MOV SI,1300H
1075 8A 04 MOV AL,[SI]
1077 E6 E0 OUT 0E0H,AL
1079 46 INC SI
107A A 04 MOV AL,[SI]
107C E6 F0 OUT 0F0H,AL
107E 46 INC SI
107F 8A 04 MOV AL,[SI]
1081 E6 E2 OUT 0E2H,AL
1083 46 INC SI
1084 8A 04 MOV AL,[SI]
1086 E6 F2 OUT 0F2H,AL
1088 46 INC SI
1089 8A 04 MOV AL,[SI]
108B E6 E4 OUT 0E4H,AL
108D 46 INC SI
108E 8A 04 MOV AL,[SI]
1090 E6 F4 OUT 0F4H,AL
1092 EB B2 JMP LOOP
1094 code ends
End

RESULT:
Thus the display the date using 8086 microprocessor has executed and verified.

49
OUTPUT: COUNTERS AND TIME DELAY
INPUT:
SET TIME DELAY:

OUTPUT:

50
Ex.No.: 06
Date :
TIME DELAY USING COUNTERS
AIM:
To provide the time delay using counters.
THOERY:
Here the time delay is generated using CX register
Steps to be followed in program
i) lcd initialization
ii) display one character
iii) get the time delay value and display character with time delay
CPLD ADDRESSES TO BE USED:
LCD DATA/COMMAND :04H
RS :06H
PROGRAM
Address Label Mnemonic Opcode Comments
1000 CALL L10 E87400
1003 CALL L11 E87A00

1006 MOV AL,38h C6C038

1009 OUT 04h,AL E6 04

100B CALL L10 E86900


E86F00
100E CALL L11

1011 MOV AL,0Eh C6C00E

1014 OUT 04h,AL E6 04

1016 CALL L10 E85E00

1019 CALL L11 E86400

101C MOV AL,01h C6C001

101F OUT 04h,AL E604

1021 CALL L10 E84E00

1024 CALL L11 E85900

1027 MOV AL,06h C6C006

102A OUT 04h,AL` E604

51
102C CALL L10 E84800

102F CALL L11 E84E00

1032 MOV AL,80h C6C080

1035 OUT 04h,AL E604

1037 CALL L10 E83D00

103A CALL L11 E84300

103D MOV AL,0Ch C6C00C

1040 OUT 04h,AL E604

1042 L1 CALL L10 E83200

1045 CALL L12 E83E00

1048 MOV AL,30h C6C030

104B OUT 04h,AL E604

104D CALL L13 E83C00

1050 CALL L10 E82400

1053 CALL L11 E82A00

1056 MOV AL,80h C6C080

1059 OUT 04h,AL E604

105B CALL L10 E81900

105E CALL L12 E82500

1061 MOV AL,35h C6C035

1064 OUT 04h,AL E604

1066 CALL L13 E82300

1069 CALL L10 E80B00

106C CALL L11 E81100

106F MOV AL,80h C6C080

1072 OUT 04h,AL E604

52
1074 JMP L1 E9CBFF
L10:
1077

1077 MOV AL,4Fh C6C04F

107A L6 SUB AL,01h 80E801

107D JNZ L6 75FB

107F RET C3

1080 L11:

1080 MOV AL,00h C6C000

1083 OUT 06h,AL E606

1085 RET C3

1086 L12

1086 MOV AL,01H C6C001

1089 OUT 06h,AL E606

108B RET C3

108C MOV SI,1150h C7C65011

1090 L3 MOV AL,[SI] 8A04

1092 L2 MOV BL,02h C6C302

1095 MUL BL F6E2

1097 MOV CX,0FFFFh C7C1FFFF

109B LOOP L2 E2FE

109D SUB AL,01h 80E801

10A0 JNZ L3 75F5

10A2 RET C3

RESULT :
Thus the value displayed in lcd with time delay

53
Ex.No.:
Date :
PROGRAM USING MASM SOFTWARE
AIM:
To write ALP for Arithmetic and logic operation using MASAM.

SOFTWARE REQUIRED:

Pc with windows (95/98/XP/NT/2000)


MASM Software

PROGRAM:
16-BIT ADDITION
ASSUME CS: CODE, DS: DATA,ES: EXTRA
DATA SEGMENT
NUM1 DW 23C5H
NUM2 DW 6789H
DATA ENDS
EXTRA SEGMENT
RESULT DW 0000H
EXTRA ENDS
CODE SEGMENT
START: MOV AX,DATA
MOV DS,AX
MOV AX,EXTRA
MOV ES,AX
SUB AX,AX //Note :
MOV AX, NUM1
MOV BX, NUM2
ADD AX,BX
MOV RESULT,AX
INT 03H
CODE ENDS
END START
END

16- BIT SUBTRACTION


ASSUME CS: CODE, DS: DATA, ES: EXTRA
DATA SEGMENT
NUM1 DW 23C5H
NUM2 DW 1789H
RESULT DW 0000H
DATA ENDS
EXTRA SEGMENT
RESULT DW 0000H //(Note: 00 or 0000H)

54
CODE SEGMENT
START: MOV AX,DATA
MOV DS,AX
MOV AX,EXTRA
MOV ES,AX
SUB AX,AX
MOV AX, NUM1
MOV BX, NUM2
SUB AX,BX
MOV RESULT,AX
INT 3H
CODE ENDS
END START
END

LOGICAL AND:
CODE SEGMENT
ASSUME CS: CODE
START: MOV AL, 85H
MOV BL, 99H
AND AL, BL
INT 3H
CODE ENDS
END START

LOGICAL OR:
CODE SEGMENT
ASSUME CS: CODE
START: MOV AL, 85H
MOV BL, 99H
OR AL, BL
INT 3H
CODE ENDS
END START
LOGICAL XOR:
CODE SEGMENT
ASSUME CS: CODE
START: MOV AL, 85H
MOV BL, 99H
XOR AL, BL
INT 3H
CODE ENDS
END

55
NOT OPERATION:
CODE SEGMENT
ASSUME CS: CODE
START: MOV AL, 85H
NOT AL
INT 3H
CODE ENDS
END START

NAND OPERATION:
CODE SEGMENT
ASSUME CS: CODE
START: MOV AL, 85H
MOV BL, 99H
AND AL, BL
NOT AL
INT 3H
CODE ENDS
END START

RESULT:
Thus the Assembly Language Program for Arithmetic and Logic operation has been
performed and the result is stored using MA

56
Ex.No.: 07
Date :
TRAFFIC LIGHT CONTROLLER USING 8086

AIM:

The objective of this experiment is to simulate a traffic lights system.


APPARATUS REQUIRED:
8086 kit , interfacing card
THEORY:
A simple contraption of a traffic control system is shown in the figure where the
signalinglights are simulated by the blinking or ON –OFF control of LED„s. The
the pedestrian crossing are simulated by the ON –OFF control of dual colo of a
four road –four lane junction, the board has gre green, orange and red signals of
an actual systems.
12 LEDs are used on the board. In addition 8 dual colour LEDs are used
which can be made to change either to red or to green. The control of the LEDs
is as follows: The board communicates with the microprocessor trainer by
means of a 26 core cable which is connected to the output pins of any parallel
port of trainer. The outputs (i.e. port) are the inputs to buffers 7406 whose
outputs drive the LEDs. The buffered output applied to the cathode of the
LEDs decides whether it is ON or OFF.

PROGRAM:

Addres Labe Opcod Mnemonics

1100 STAR BB 00 11 MOV BX, 1200H


1103 B9 08 00 MOV CX, 0008H
1106 8A 07 MOV AL,[BX]
1108 BA 36 FF MOV DX, CONTROL
PORT
110B EE OUT DX, AL
110C 43 INC BX
110D NEXT 8A 07 MOV AL,[BX]
110F BA 30 FF MOV DX, PORT A
1112 EE OUT DX,AL
1113 43 INC BX
1114 8a 07 MOV AL,[BX]
1116 BA 32 FF MOV DX,PORT B

57
1119 EE OUT DX,AL
111A E8 07 00 CALL DELAY
111D E2 F1 INC BX
111E LOOP NEXT
1120 EB E4 JMP START
1122 DELAY: 51 PUSH CX
1124 B9 00 05 MOV CX,0005H
1126 REPEAT: BA FF FF MOV DX,0FFFFH
1129 LOOP2: 4A DEC DX
112A 75 FD JNZ LOOP2
112C E2 F8 LOOP REPEAT
112E 59 POP CX
112F C3 RET

LOOK UP TABLE

Address Opcode
1200 80H
1201 21H,09H,10H,00H (SOUTH
WAY)
1205 0CH,09H,80H,00H (EAST
WAY)
1209 64H,08H,00H,04H (NOURTH
WAY)
120D 24H,03H,02H,00H (WEST
WAY)
1211 END

58
RESULT:
Thus the assembly language program for traffic light controller has been impleme

59
Ex.No.: 08
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.

ALGORITHM:

For running stepper motor clockwise and anticlockwise directions


(i) Get the first data from the lookup table.
(ii) Initialize the counter and move data into accumulator.
(iii) Drive the stepper motor circuitry and introduce delay
(iv) Decrement the counter is not zero repeat from step(iii)
(v) Repeat the above procedure both for backward and forward directions.

SWITCHING SEQUENCE OF STEPPER MOTOR:

MEMORY A1 A2 B1 B2 HEX
LOCATION 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

60
FLOWCHART:
START

INTIALIZE COUNTER FOR LOOK UP TABLE

GET THE FIRST DATA FROM THE ACCUMULATOR

MOVE DATA INTO THE ACCUMULATOR

DRIVE THE MOTOR

DELAY

DECREMENT COUNTER

YES
IS B = 0 ?
NO

GET THE DATA FROM LOOK UP

PROGRAM TABLE
ADDRESS PROGRAM COMMENTS
1000 Initialize memory location to
START : MOV DI, 1200H store the array of
number
1004 MOV CX, 0004H Initialize array size
1008 LOOP 1 : MOV AL,[DI] Copy the first data in AL
100A
OUT 0C0,AL Send it through port address
100C MOV DX, 1010H
1010 L1 : DEC DX Introduce delay
1011 JNZ L1
101B INC DI Go to next memory location
1014 LOOP LOOP1 Loop until all the dat
1016 Go to start location for
JMP START continuous rotation
1200 : 09,05,06,0A Array of datas

61
RESULT:
Thus the assembly language program for rotating stepper motor in both clockwise and
anticlockwise directions is written and verified.

62
OUTPUT: DIGITAL CLOCK

MEMEORY DESCRIPTION VALUE

1500

1501

1502

The output will be displayed in LCD screen like below,

63
Ex.No.: 09
Date :
DIGITAL CLOCK

AIM
To display the digital clock specifically by displaying the hours, minutes
and seconds using 8086 kits.
APPARATUS REQUIRED

S.No Item Specification


1 Microprocessor kit 8086
2 Power Supply 5V

Preliminary Settings
Org 1000h
Store time value in memory location 1500- Seconds
1501- Minutes
1502- Hours
Digital clock program

64
68
ADDRESS MNEMONICS OPCODE
1099 MOV[BX],AL 8B07
109B DEC BX 4B
109C MOV AL,3AH C6C0
109F MOV[BX],AL 8807
10A1 DEC BX 4B
10A2 INC SI 46
10A3 MOV AL,[SI] 8A04
10A5 MOV AH,0 C6C400
10A8 MOV DH,0AH C6C60A
10AB DIV DH F6F6
10AD ADD AH,30H 80C430
10B0 MOV[BX],AH 8827
10B2 DEC BX 4B
10B3 ADD AL,30H 80C030
10B6 MOV [BX],AL 8807
10B8 MOV AL,3AH C6C03A
10BB MOV [BX],AL 8807
10BD DEC BX 4B
10BE INC SI 46
10BF MOV AL,[SI] 8A04
10C1 MOV AH,0 C6C400
10C4 MOV DH,OAH C6C60A
10C7 DIV DH F6F6
10C9 ADD AH,30H 80C430
10CC MOV [BX],AH 8827
10CE DEC BX 4B
10CF ADD AL,30H 80C030
10D2 MOV [BX],AL 8807
10D4 RET C3
10D5 GETC C3
10D6 IN AL,02H E402
10DB CMP AL,0F0H 80F8F0
10DE JNE GETC 75F5

69
RESULT:
Thus the digital clock program has been written and executed using 8086
microprocessor kit and the output of digital clock was displayed as [hours: minutes: seconds]
successfully.

70
OUTPUT: Keyboard and Display

71
Ex.No.: 10
Date :
INTERFACING 8279 WITH 8086
AIM:
To display Rolling message in display using 8279 programmable keyboard/display controller by
interfacing it with 8086.

APPARATUS REQUIRED:
S.No Apparatus Quantity
1 Microprocessor kit-8086 1
2 Keyboard display Interface-8279 1
3 Connecting cable -

DESCRIPTION:
The INTEL 8279 is specially developed for interfacing keyboard and display devices to
8085/8086/8088 microprocessor based system.
The important features of 8279 are,
 Simultaneous keyboard and display operations.
 Scanned keyboard mode.
 Scanned sensor mode.
 8-character keyboard FIFO.
 16-character display.
 Right or left entry 1 6-byte display RAM.
 Programmable scan timing.DISPLAY SECTION:
 The display section has eight output lines divided into two groups A0-A3 and B0-B3.

 The output lines can be used either as a single group of eight lines or as two groups of our
lines, in conjunction with the scan lines for a multiplexed display.

 The output lines are connected to the anodes through driver transistor in case of common
cathode 7-segment LEDs.
 The cathodes are connected to scan lines through driver transistors.

Display mode setup command: [10]

0 0 0 D D K K K
0 0 0 1 0 0 0 0

72
Clear Display Command: [CC]

1 1 0 CD2 CD1 CD0 CF CA


1 1 0 0 1 1 0 0

Display RAM Command: [90]

1 0 0 AI A A A A
1 0 0 1 0 0 0 0

Seven segment code for the message :

Character D c b a Dp G f e Seven segment code

H 1 0 0 1 1 0 0 0 98
E 0 1 1 0 1 0 0 0 68
L 0 1 1 1 1 1 0 0 7C
P 1 1 0 0 1 0 0 0 C8
U 0 0 0 1 1 1 0 0 1C
S 0 0 1 0 1 0 0 1 29

 The display can be blanked by BD (low) line.


 The display section consists of 16 x 8 display RAM. The CPU can read from or write
into any location of the display RAM.

In common anode type seven segment display, 0 is used for a segment to glow and 1 for a
segment to remain in off condition.

73
ALGORITHM :

1. Store the look up table which contains the common anode seven segment code for the message
„HELP US‟ from memory location 12
2. Load the number of characters to be displayed in CX reg.
3. Move display mode set up command to acc. And then load it in command reg.
4. Move clear command to acc. and then load it in command reg.
5. Move display RAM command to acc. And then load it in command reg.
6. Then move common anode seven segment codes one by one for the character to be
displayed to accumulator from memory and then load it in data reg.
7. Call delay subroutine between each code.
8. Repeat step 2 to 7 to get continuous disp
PROGRAM -1 :

To Display ‘A’ in the first digit:

Address Label Opcode Mnemonics


1000 START: C6C000 MOV AL,00
1003 E6C2 OUT C2,AL
1005 C6C0CC MOV AX,00CC
1008 E6C2 OUT C2,AL
100A C6C090 MOV AL,90
100D E6C0 OUT C2,AL
100F C6C088 MOV AL,88
1012 E6C0 OUT C0,AL
1014 C6C0FF MOV AX,00FF
1017 C7C10500 MOV CX,0005
101B NEXT: E6C0 OUT C0,AL
101D E2FC LOOP NEXT
101F F4 HLT

PROGRAM –2 :

ROLLING DISPLAY:

Address Label Opcode Mnemonics


1000 START: C7 C6 00 12 MOV SI,1200
1004 C7 C1 0F 00 MOV CX,000F
1008 C6 C0 10 MOV AL,10
100B E6 C2 OUT C2,AL

75
100D 80C8 MOV AL,CL
100F E6 C2 OUT C2,AL
1011 C6 C0 90 MOV AL,90
1014 E6 C2 OUT C2,AL
1016 NEXT: 8A 04 MOV AL,[SI]
1018 E6 C0 OUT C0,AL
101A E8 06 00 CALL DELAY
101D 46 INC SI
101E E2 F6 LOOP NEXT
1020 E9 DD FF JMP START
1023 DELAY: C7 C2 FF A0 MOV DX,0A0FF
1027 LOOP1: 4A DEC DX
1028 75 FD JNZ LOOP1
102A C3 RET

LOOK UP TABLE:
1200 FF FF FF FF
1204 FF FF FF FF
1208 98 68 7C C8
120C FF 1C 29 FF

76
RESULT:
Thus the keyboard display controller 8279 is interfaced with 8086 p and the message
„HELPUS‟ is displayed.

77
Ex.No.: 11(A)
Date :
:
SERIAL INTERFACE AND PARALLEL INTERFACE

Aim
To connect two 8086 microprocessor kits and to serially communicate
with each other by considering transmitter and receiver kits.
Apparatus required

Procedure
1. Take two no of 8086 microprocessor kits.
2. Enter the transmitter program in transmitter kit.
3. Enter the receiver program in receiver kit.
4. Interface the two kits with 9-9 serial cable in the serial port of the microprocessor kits.
(LCD kit means PC-PC cable. LED kit means kit-kit cable)
5. Enter the data in transmitter kit use the memory location 1500.
6. Execute the receiver kit.
7. Execute the transmitter kit.
8. Result will be available in receiver kit memory location 1500.
Transmitter Prog

78
Receiver Program

79
RESULT:
Thus the serial communication between two 8086 microprocessor kits
has been established and the data is transmitted in one kit and received in the
other kit successfully.

80
Ex.No.: 11(B)
Date :
PARALLEL COMMUNICATION BETWEEN TWO 8086
MICROPROCESSORS KITS
Aim
To connect two 8086 microprocessor kits and to establish parallel communication with
each other by considering transmitter and receiver kits.
Apparatus required

Procedure
1. Take two 8086 microprocessor kits.
2. Enter the transmitter program in transmitter kit.
3. Enter the receiver program in receiver kit.
4. Interface the two kits with 26-core cable on PPI-1.
5. Execute the receiver kit.
6. Execute the transmitter kit.
7. Go and see the memory location 1200 in receiver to get same eight data.
8. Data is available in transmitter kit in the memory location.
9. Change the data & execute the following procedure & get the result in receiver kit.

Transmitter program

83
Receiver Program

84
RESULT:

Thus the serial communication between two 8086 microprocessor kits has been
established and the data is transmitted in one kit and received in the other kit successfully.

85
RESULT: Analog to Digital
ANALOG DIGITAL DATA ON LED
VOLTAGE DISPLAY

86
Ex.No.: 12(A)
Date :
A/D INTERFACE AND WAVEFORM GENERATION
AIM:

To write an assembly language program to convert an analog signal into a 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.
The following program initiates the conversion process, checks the EOC pin of ADC 0809 as
to whether the conversion is over and then inputs the data to the processor. It also instructs
the processor to store the converted digital data at RAM location.
ALGORITHM:
(i) Select the channel and latch the address.
(ii) Send the start conversion pulse.
(iii) Read EOC signal.
(iv) If EOC = 1 continue else go to step (iii)
(v) Read the digital output.
(vi) Store it in a memory location.
FLOW CHART:
START

SELECT THE CHANNEL AND LATCH

SEND THE START CONVERSION PULSE

NO
IS EOC = 1?

YES

READ THE DIGITALOUTPUT

STORE THE DIGITAL VALUE IN THE


MEMORY LOCATION SPECIFIED

STOP

87
PROGRAM TABLE
ADD OPCODE
RESS PROGRAM COMMENTS

1000 C6C00 Load accumulator with value for ALE


MOV AL,00 high
1003 E6C8 OUT 0C8H,AL Send through output port
1005 C6008 Load accumulator with value for ALE
MOV AL,08 low
1008 E6C8 OUT 0C8H,AL Send through output port
100A C6C001 Store the value to make SOC high in
MOV AL,01 the accumulator
100D E6D0 OUT 0D0H,AL Send through output port
100F C6C00 MOV AL,00
1012 C6C00 MOV AL,00 Introduce delay
1015 C6C00 MOV AL,00
1018 C6C00 Store the value to make SOC low the
MOV AL,00 accumulator
101B E6D0 OUT 0D0H,AL Send through output port
101D E4D8 L1 : IN AL, 0D8H
101F 80E001 Read the EOC signal from port &
AND AL,01 check for end of
1022 80F801 conversion
CMP AL,01
1025 75E6 If the conversion is not yet completed,
JNZ L1 read EOC signal
from port again
1027 E4C0 IN AL,0C0H Read data from port
1029 C7C30011 Initialize the memory location to store
MOV BX,1100 data
102D 8807 MOV [BX],AL Store the data
102F F4 HLT Stop

88
RESULT:
Thus the ADC was interfaced with 8086 and the given analog inputs were
converted into its digital equivalent.

89
OUTPUT: WAVEFORM GENERATION: DIGITAL TO ANALOG

WAVEFORMS AMPLITUDE TIMEPERIOD

Square Waveform
Saw-tooth waveform

Triangular waveform

90
Ex.No.: 12(B)
Date :
INTERFACING DIGITAL –TO –ANALOG CONVERTER
AIM :
1. To write an assembly language program for digital to analog conversion
2. To convert digital inputs into analog outputs & 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. Repeat this
sequence again and again. As a result a triangular wave will be generated at DAC2 output.
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.
(v) Decrementing and sending the accumulator contents to DAC.

91
PROGRAM TABLE: Square Wave

PROGRAM COMMENTS

L2 : MOV AL,00H Load 00 in accumulator

OUT C0,AL Send through output port

CALL L1 Give a delay

MOV AL,FFH Load FF in accumulator

OUT C0,AL Send through output port

CALL L1 Give a delay

JMP L2 Go to starting location

L1 : MOV CX,05FFH Load count value in CX register

L3 : LOOP L3 Decrement until it reaches zero

RET Return to main program

PROGRAM TABLE: Saw tooth Wave

PROGRAM COMMENTS

L2 : MOV AL,00H Load 00 in accumulator

L1 : OUT C0,AL Send through output port

INC AL Increment contents of accumulator

JNZ L1 Send through output port until it reaches FF

JMP L2 Go to starting location

92
PROGRAM TABLE: Triangular Wave

PROGRAM COMMENTS

L3 : MOV AL,00H Load 00 in accumulator

L1 : OUT C0,AL Send through output port

INC AL Increment contents of accumulator

JNZ L1 Send through output port until it reaches FF

MOV AL,0FFH Load FF in accumulator

L2 : OUT C0,AL Send through output port

DEC AL Decrement contents of accumulator

JNZ L2 Send through output port until it reaches 00

JMP L3 Go to starting location

MODEL GRAPH:

Square Waveform Saw-tooth waveform

Triangular waveform

RESULT:
Thus the DAC was interfaced with 8085 and different waveforms have been generated.

93
PROGRAMS USING 8051
AND MASM

94
OUTPUT: 8BIT ADDITION

INPUT OUTPUT

MEMORY 4101 4103 4500 4501

DATA

95
Ex.No.: 13(A)
Date :
8 BIT ADDITION

AIM:
To write a program to add two 8-bit numbers using 8051 microcontroller.

ALGORITHM:

1. Clear Program Status Word.


2. Select Register bank by giving proper values to RS1 & RS0 of PSW.
3. Load accumulator A with any desired 8-bit data.
4. Load the register R 0 with the second 8- bit data.
5. Add these two 8-bit numbers.
6. Store the result.
7. Stop the program.

8 Bit Addition (Immediate Addressing)


ADDRESS LABEL MNEMONIC OPERAND HEX COMMENTS
CODE
4100 CLR C C3 Clear CY Flag

4101 MOV 74,data1 Get the data1 in


A,#DATA1 Accumulator
4103 ADDC A, # data 2 24,data2 Add the data1 with
data2
4105 MOV DPTR, # 90,45,00 Initialize the memory
4500H Location
4108 MOVX @ DPTR, A F0 Store the result in
memory location
4109 L1 SJMP L1 80,FE Stop the program

RESULT:

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

96
OUTPUT: SUBTRACTION

INPUT OUTPUT

MEMORY 4101 4103 4500 4501

DATA

97
Ex.No.: 13(B)
Date :
8 BIT SUBTRACTION

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

ALGORITHM:
a. Clear the carry flag.
b. Initialize the register for borrow.
c. Get the first operand into the accumulator.
d. Subtract the second operand from the accumulator.
e. If a borrow results increment the carry register.
Store the result in memory. 8 Bit
Subtraction (Immediate Addressing)
ADDRESS LABEL MNEMONIC OPERAND HEX COMMENTS
CODE
4100 CLR C C3 Clear CY flag

4101 MOV A, # data1 74, data1 Store data1 in


Accumulator
4103 SUBB A, # data2 94,data2 Subtract data2 from
data1
4105 MOV DPTR, # 4500 90,45,00 Initialize memory
Location
4108 MOVX @ DPTR, A F0 Store the difference
in memory location
4109 L1 SJMP L1 80,FE Stop

RESULT:

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

98
OUTPUT: 8Bit Multiplication

INPUT OUTPUT

MEMORY 4101 4104 4500 4501

DATA

100
Ex.No.: 13(C)
Date :

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

ALGORITHM:
a. Get the multiplier in the accumulator.
b. Get the multiplicand in the B register.
c. Multiply A with B.
d. Store the product in memory.

8 Bit Multiplication
ADDRESS LABEL MNEMONIC OPERAND HEX COMMENTS
CODE
4100 MOV A ,#data1 74, data1 Store data1 in
Accumulator
4102 MOV B, #data2 75,data2 Store data2 in B reg

4104 MUL AB A4 Multiply both

4105 MOV DPTR, # 90,45,00 Initialize memory


4500H Location
4109 MOVX @ DPTR, A F0 Store lower order
Result
410A INC DPTR A3 Go to next memory
Location
410B MOV AB F5,E0
Store higher order
410D MOVX @ DPTR, A F0 Result

410E STOP SJMP STOP 80,FE Stop

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

101
OUTPUT: 8bit Division

INPUT OUTPUT

MEMORY 4101 4104 4500 4501

DATA

102
Ex.No.: 13(D)
Date :
8 BIT DIVISION

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

ALGORITHM:
1. Get the Dividend in the accumulator.
2. Get the Divisor in the B register.
3. Divide A by B.
4. Store the Quotient and Remainder in memory.

8 Bit Division
ADDRESS LABEL MNEMONIC OPERAND HEX COMMENTS
CODE
4100 MOV A, # data1 74,data1 Store data1 in
accumulator
4102 MOV B, # data2 75,data2 Store data2 in B reg

4105 DIV AB 84 Divide

4106 MOV DPTR, # 4500H 90,45,00 Initialize memory


location
4109 MOVX @ DPTR, A F0 Store remainder

410A INC DPTR A3 Go to next memory


location
410C MOV AB F5,E0
Store quotient
410D MOVX @ DPTR, A F0

410E STOP SJMP STOP 80,FE Stop

RESULT:

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

103
OUTPUT: SQUARE

OUTPUT
MEMORY LOCATION DATA

4500

OUTPUT: CUBE

OUTPUT
MEMORY LOCATION DATA

4500

104
Ex.No.: 14(A)
Date :
PROGRAM TO FIND SQUARE AND CUBE OF A NUMBER

AIM :

To write an assembly language program to find square and cube of a number using 8051.

APPARATUS REQUIRED:
8051 Microprocessor Kit

ALGORITHM:
1. Store the eight bit number x in A, rO & B registers.
2. Multiply A and B registers to obtain the square (say SQH:SQL) of the number x
3. Check if bit 01 is set If set go to end (storing the result), else do the cube operations.
4. The high pail of the square result (SQH) is stored on the stack.
5. Multiply the low part of the square result (SQL) with x (partial cube result).
6. Store the low part of the above result at 9001H & the high part in R2.
7. Retrieve the high part of the square result (SQH) stored on the stack & multiply with x.
8. Add the low part of the above result (SQH*X) with R2 and store in 9002H.
9. Add the high part (SQH*X) with the resulting carry and store in 9003.

PROGRAM: SQUARE:
ADDRESS LABEL MNEMONIC OPERAND HEX COMMENTS
CODE
4100 MOV A ,#02 7402 Store data1 in
Accumulator
4102 MOV B, A F5F0 Store data2 in B reg

4104 MUL A,B A4 Multiply both

4105 MOV DPTR, # 904500 Initialize memory


4500H Location
4108 MOVX @ DPTR, A F0 Store lower order
Result
4019 INC DPTR A3 Go to next memory
Location
410A MOV A,B F5E0
Store higher order
410C MOVX @ DPTR, A F0 Result

410D STOP SJMP STOP Stop


80FE

105
CUBE:
HEX
ADDRESS LABEL MNEMONIC CODE COMMENTS

4100 MOV A,#02 7402


4102 MOV B,A F5F0

4104 MOV R0,A F8

4105 MUL AB A4

4106 PUSH B C0F0

4108 MOV B,A F5F0

410A MOV A,R0 E8

410B MUL AB A4

410C INC DPTR A3

410D MOV 904500


DPTR,#4500
4110 MOVX F0
@DPTR,A
4111 INC DPTR A3

4112 MOV A,B E5F0

4114 MOVX F0
@DPTR,A
4115 STOP SJMP 4115 80FE

106
RESULT:

Thus the Assembly Language Program to find square and cube of a given number using 8051 has
been performed and the result is stored.

107
OUTPUT: 2’S COMPLEMENT OF A NUMBER USING 8051

INPUT OUTPUT
MEMORY 4101 4200
DATA

108
Ex.No.: 14(B)
Date :
2’S COMPLEMENT OF A NUMBER USING 8051

AIM :

To obtain 2’s complement of an 8-bit number in register A.


APPARATUS REQUIRED:

8051 microcontroller kit, Power Supply


THEORY:
The one„s complement of a number is obtaine replacing all 1„s by 0„s and all 0„s by 1„s. T

PROCEDURE:
1) Enter the opcodes and the data in the trainer.
2) Execute the program and check for results.
3) Change data and check for the corresponding results.

RESULT:

Thus the assembly language program for obtaining 2’s complement of a number has been
given.

109
Ex.No.: 15
Date :

Unpacked BCD to ASCII


AIM:
To write an ALP program to convert the unpacked BCD number into an ASCII number and
display it at P0.

ALGORITHM:
1. Get unpacked BCD number into accumulator
2. OR it with 30H to get ASCII number
3. Display it at PO.

PROGRAM:
ORG 00
SJMP START
MOV B,A
ANL A,#0FH
ADD A,#30H
MOV R0,A
MOV A,B
ANL A,#F0H
SWAP A
ADD A,#30H
MOV R1,A
MOV DPTR,#4500
MOVX @DPTR,A
INC DPTR
MOV A,B
MOVX @DPTR,A
SJMP HERE

RESULT:

Thus the Assembly Language Program to convert unpacked BCD to ASCII code conversion
using 8051 has been performed and the result is stored.

111

You might also like