0% found this document useful (0 votes)
25 views77 pages

MPMC Lab Manual

Uploaded by

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

MPMC Lab Manual

Uploaded by

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

EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE

LAB
EXPT.NO NAME OF THE EXPERIMENT PAGE
NO
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

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

14 Basic arithmetic and Logical operations

15 Square and Cube program, Find 2’s complement of a


Number
16 Unpacked BCD to ASCII

2
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
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 ITEM QUANTITY


O
1. 8086 Microprocessor kit 1
2. Power Chord 1
3. Keyboard 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 (iii) Multiplication of 16-bit
 Initialize the MSBs of sum to 0 numbers:
 Get the first number.  Get the multiplier.
 Add the second number to the first  Get the multiplicand
number.  Initialize the product to 0.
 If there is any carry, increment  Product = product +
MSBs of sum by 1. multiplicand
 Store LSBs of sum.  Decrement the multiplier by 1
 Store MSBs of sum.  If multiplicand is not equal to
0,repeat from step (d) otherwise
(ii) 16-bit subtraction store the product.
 Initialize the MSBs of difference to (iv) Division of 16-bit numbers.
0  Get the dividend
 Get the first number  Get the divisor
 Subtract the second number from  Initialize the quotient to 0.
the first number.  Dividend = dividend – divisor
 If there is any borrow, increment  If the divisor is greater, store the
MSBs of difference by 1. quotient. Go to step g.
 Store LSBs of difference  If dividend is greater, quotient
 Store MSBs of difference. = quotient + 1. Repeat from
step (d)Store the dividend
value as remainder.

3
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
FLOWCHART

ADDITION SUBTRACTION

START START

SET UP COUNTER (CY) SET UP COUNTER (CARRY)

GET FIRST OPERAND GET FIRST


OPERAND TO A

GET SECOND OPERAND SUBTRACT


TO A SECOND OPERAND
FROM MEMORY

YES
A=A+B
IS THERE
ANY CY
YES
NO COUNTER =
IS THERE COUNTER =
ANY CARRY COUNTER + 1 COUNTER + 1

STORE THE
DIFFERENCE
NO

STORE THE SUM


STORE THE CARRY

STORE THE CARRY STOP

STOP

4
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
ADDITION

Address Mnemonics Opcode Commands


1000 MOV AX,[1100] 8B
1001 06
1002 00
1003 11
1004 ADD AX,[1102] 03
1005 06
1006 02
1007 11
1008 89
MOV [1200],AX
1009 06
100A 00
100B 12
100C HLT F4

SUBTRACTION

Address Mnemonics Opcode Commands

1000 MOV AX,[1100] 8B


1001 06
1002 00
1003 11
1004 SUB AX,[1102] 2B
1005 06
1006 02
1007 11
1008 MOV [1200],AX 89
1009 06

100A 00

100B 12

100C HLT F4

5
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
FLOWCHART

MULTIPLICATION DIVISION

Start
Start

Load Divisor &


Get Multiplier & Multiplicand Dividend
Get Multiplier & Multiplicand
MULTIPLICAND
MULTIPLICAND

QUOTIENT = 0
REGISTER=00
REGISTER=00

DIVIDEND =
DIVIDEND-DIVISOR
REGISTER = REGISTER
REGISTER =
+ MULTIPLICAND
REGISTER +
MULTIPLICAND

QUOTIENT = QUOTIENT+1
Multiplier=MULTIPLI
ER Multiplier=MU
–1
LTIPLIER – 1

IS
NO DIVIDEN
D<
DIVISOR
NO IS
MULTIPLIER ?
=0?
YES

YES STORE QUOTIENT


STORE REMAINDER
STORE THE RESULT = DIVIDEND NOW

STOP STOP

6
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

MULTIPLICATION

Address Mnemonics Opcode Commands


1000 MOV AX,[1100] 8B
1001 06
1002 00
1003 MOV BX,[1102] 11
1004 8B
1005 1E
1006 02
1007 11
1008 MUL BX F7
1009 E3
100A MOV[1200],DX 89
100B 16
100C 00
100D 12
100E MOV[1202],AX 89
100F 06
1010 02
1011 12
1012 HLT F4

DIVISION

Address Mnemonics Opcode Commands


1000 MOV AX,[1100] 8B

1001 06
1002 00
1003 MOV BX,[1102] 11
1004 8B
1005 1E
1006 10
1007 01

7
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
1008
LAB DIV BX F7
1009 F3
100A MOV[1200],AX 89
100B 06
100C 00
100D 12
100E MOV[1202],DX 89
100F 16
1010 02
1011 12
1012 HLT F4

RESULT:.

Thus Arithmetic operation of two byte numbers are performed and the result is stored.

8
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

LOGICAL OPERATION
AIM:
To perform basic logical operations AND,OR,XOR and NOT
ALGORITHM:
 Start the Program.
 Get the first data from 1100
 Get the Second data from 1100
 Set pointer in 1130 address
 Perform logical instruction
 Store the Result
 Stop the program

PROGRAM:
AND:

ADDRESS MNEMONICS OPCODE COMMANDS


1000 MOV AL,[1100] 8A060011 Move 1100 to AL
1004 MOV BL,[1120] 8A1E2011 Move 1120 to BL
1008 MOV SI,1130 C7C63011 Move 1130 to SI
100C AND AL,BL 20D8 AND instruction
100E MOV [SI],AL 8804 Move AL to SI
1010 HLT F4 Stop the program

OR

ADDRESS MNEMONICS OPCODE COMMANDS


1000 MOV AL,[1100] 8A060011 Move 1100 to AL
1004 MOV BL,[1120] 8A1E2011 Move 1120 to BL
1008 MOV SI,1130 C7C63011 Move 1130 to SI
100C OR AL,BL 08D8 OR instruction
100E MOV [SI],AL 8804 Move AL to SI
1010 HLT F4 Stop the program

XOR

ADDRESS MNEMONICS OPCODE COMMANDS


1000 MOV AL,[1100] 8A060011 Move 1100 to AL
1004 MOV BL,[1120] 8A1E2011 Move 1120 to BL
1008 MOV SI,1130 C7C63011 Move 1130 to SI
100C XOR AL,BL 20D8 XOR instruction
100E MOV [SI],AL 8804 Move AL to SI
1010 HLT F4 Stop the program

NOT

ADDRESS MNEMONICS OPCODE COMMANDS


1000 MOV AL,55 C6C0C5 Move 55 to AL
1003 NOT AL F6D NOT instruction
1005 MOV [1100],AL 88060011 Move AX to 1100
1009 HLT F4

9
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

RESULT:

Thus the program for logical operation was executed and the output was verified successfully.

10
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
MOVE A DATA BLOCK WITHOUT OVERLAP

EXP.NO: 02 DATE:
AIM:
To convert a given Move a data block without overlap
.
ALGORITHM:
1. Initialize the memory location to the data pointer.
2. Increment B register.
3. Increment accumulator by 1 and adjust it to decimal every time.
4. Compare the given decimal number with accumulator value.
5. When both matches, the equivalent hexadecimal value is in Bregister.
6. Store the resultant in memory location.

PROGRAM

Address Mnemonics Opcode Commands


1000
MOV SI,1100 C7C60011 Move 1100 to SI
1004
MOV DI,1200 C7C70012 Move 1200 to DI

1008 MOV CX,05 C7C10500 Move 05 to CX


8B04
100C MOV AX,[SI] Move SI to AX

100E MOV [DI],AX 8905 Move AX to DI

1010 INC SI 46 Increment SI

1011 INC SI 46 Increment SI

1012 INC DI 47 Increment DI

1013 INC DI 47 Increment DI

1014 LOOP 100C E2F6 Get into Loop

1015 HLT F4 Stop the program

RESULT:
Thus the output for the Move a data block without overlap was executed successfully

11
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
CODE CONVERSION, DECIMAL ARITHMETIC
AND MATRIX OPERATIONS.

EXP.NO: 03 CODE CONVERSIONS –DECIMAL TO HEX DATE:


AIM:
To convert a given decimal number to hexadecimal.
ALGORITHM:
1. Initialize the memory location to the data pointer.
2. Increment B register.
3. Increment accumulator by 1 and adjust it to decimal every time.
4. Compare the given decimal number with accumulator value.
5. When both matches, the equivalent hexadecimal value is in Bregister.
6. Store the resultant in memory location.
FLOWCHART :

12
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

PROGRAM:

ADDRESS OPCODE MNEMONICS COMMENTS

1000 8B060011 MOV AX,[1100] Move the contents from 1100 to acc

1004 81E00F00 AND AX,000F Performs AND operation of acc value with 000F
1008 89060012 MOV[1200],AX Store the result at 1200
100C 89060011 MOV AX,[1100] Move the original Contents to acc
1010 C6C104 MOV CL,04 Set the counter value to 04
1013 D3C8 ROR AX,CL Rotate the contents of acc right by 4 times
1015 81E00F00 AND AX,000F Performs AND operation of acc value with 000F
1019 C7C10A00 MOV CX,0A Move the value OA to C reg
101D F7E1 MUL CX Multiply OA with acc value
101F 03060012 ADD AX,[1200] Add the contents of Previous Result with acc value
1023 89060012 MOV[1200],AX Move the new result to 1200
1027 8B060011 MOV AX,[1100] Move the original Contents to acc
1028 C6C108 MOV CL,08 Set the counter value to 08
102E D3C8 ROR AX,CL Rotate the contents of acc right by 8 times
1030 81E00F00 AND AX,000F Performs AND operation of acc value with 000F
1034 C7C16400 MOV CX,64 Move the value 64 to C reg
1038 F7E1 MUL CX Multiply 64 with acc value
103A 03060012 ADD AX,[1200] Add the contents of Previous Result with acc value
103E 89060012 MOV[1200],AX Move the new result to 1200
1042 8B060011 MOV AX,[1100] Move the original Contents to acc
1046 C6C10C MOV CL,0C Set the counter value to 0C
1049 D3C8 ROR AX,CL Rotate the contents of acc right by 0C times
104B 81E00F00 AND AX,000F Performs AND operation of acc value with 000F
104F C7C1E803 MOV CX,3E8 Move the value 3E8 with acc value
1053 F7E1 MUL CX Multiply 3E8 with acc value
1055 03060012 ADD AX,[1200] Add the contents of Previous Result with acc value
1059 89060012 MOV[1200],AX Move the new result to 1200
105D F4 HLT Stop the Program

13
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

CODE CONVERSION –HEXADECIMAL TO DECIMAL


AIM:
To convert a given hexadecimal (FFFF)number to decimal.
ALGORITHM:
1. Initialize the memory location to the data pointer.
2. Increment B register.
3. Increment accumulator by 1 and adjust it to decimal every time.
4. Compare the given hexadecimal number with B register value.
5. When both match, the equivalent decimal value is in A register.
6. Store the resultant in memory location.

Address Mnemonics Opcode Commands

1000 MOV AX,FFFF B8FFFF


1003 MOV DX,0 BA0000 Divide by 1000010
1006 DIV W,[1043];Divide by 1000010 F7364310
100A AND AX,00FF 25FF00
100D MOV[1200],AL A20012
1010 MOV AX,DX 8BC2
1012 MOV DX,O BA0000 Divide by 100010
1015 DIV[1045], Divide by 1000010 F7364510
1019 AND AX,OOFF 25FF00
101C MOV[1201],AL A20112
101F MOV AX,DX 8BC2
1021 DIV[1047],Div by 10010 F6364710 Divide by 10010
1024 MOV [1202],AL A20212
1027 AND AX,0FF00 2500FF
102B MOV AL,AH 8ACH
102D MOV AL,O BA00
102F DIV[1048],Div by 1010 F6364810 Divide by 1010
1033 MOV[1203],AL A20312
1036 MOV[1204],AH 88260412
103A HLT F4

14
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

DECIMAL ARITHMETIC OPERATIONS


(i)Addition
(ii)Subtraction
AIM:
To perform a addition and subtraction operation between two decimal numbers.
APPARATUS REQUIRED:
8086 Microprocessor Kit
ALGORITHM:
1. Initialize the pointer only for data and result
2. Load AL with count
3. Add two matrix by each element
4. Process continues until CL is zero
5. Store result.

FLOWCHART
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

PROGRAM:

(i)Addition:

Address Mnemonics Opcode Commands


1000 MOV SI,1100 C7C60011 Initialize array size
1004 MOV AL,[SI] 8A04 Initialize the accumulator
1006 INC SI 46 Increment SI
1007 MOV BL,[SI] 8A1C Move the Contents of SI to BL
1009 ADD AL,BL 00D8 Add two data
100B DAA 27 Decimal Adjust accumulator
100C INC SI 46 Increment SI
100D MOV[SI],AL 8804 Move AL to SI
100F HLT F4 Stop the Program

(ii)Subtraction:

Address Mnemonics Opcode Commands


1000 MOV SI,1100 C7C60011 Initialize array size
1004 MOV AL,[SI] 8A04 Initialize the accumulator
1006 INC SI 46 Increment SI
1007 MOV BL,[SI] 8A1C Move the Contents of SI to BL
1009 SUB AL,BL 00D8 Subtract two data
100B DAS 27 Decimal Adjust Subtraction.
100C INC SI 46 Increment SI
100D MOV[SI],AL 8804 Move AL to SI
100F HLT F4 Stop the Program

RESULT:
Thus the ALP program for addition &Subtraction using Decimal Arithmetic Operation is
Calculated and Verified Successfully.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

MATRIX OPERATION
AIM:
To Perform addition and Subtraction of two 3x3 Matrix.

APPARATUS REQUIRED:
8086 Microprocessor Kit

PROGRAM:

(i)ADDITION:

Address Mnemonics Opcode Commands


1000 MOV CL,09 C6C109 Move data to 09
1003 MOV SI,1100 C7C60011 Move data to 1100
1007 MOV DI,1150 C7C70511 Move data to 1150
1008 MOV AL,[SI] 8A04 Move SI to AL Reg
100D MOV BL,[DI] 8A1D Move DI to BL Reg
100F ADD AL,BL 00D8 ADD AL and BL Reg
1011 MOV [DI],AL 8805 Move AL to DI Reg
1013 INC DI 47 Increment to DI
1014 INC SI 46 Increment to SI
1015 DEC CL FEC9 Decrement of CI
1017 INZ 100B 75F2 Jump to 100b
1019 HLT F4 Stop the Program

(ii)SUBTRACTION:

Address Mnemonics Opcode Commands


1000 MOV CL,09 C6C109 Move data to 09
1003 MOV SI,1100 C7C60011 Move data to 1100
1007 MOV DI,1150 C7C70511 Move data to 1150
100B MOV AL,[SI] 8A04 Move SI to AL Reg
100D MOV BL,[DI] 8A1D Move DI to BL Reg
100F SUB AL,BL 8808 ADD AL and BL Reg
1011 MOV [DI],AL 8805 Move AL to DI Reg
1013 INC DI 47 Increment to DI
1014 INC SI 46 Increment to SI
1015 DEC CL FEC9 Decrement of CI
1017 INZ 100B 75F2 Jump to 100b
1019 HLT F4 Stop the Program

RESULT:
Thus the output for the addition and subtraction for two matrix was executed
successfully.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

FLOATING POINT OPERATIONS, STRING MANIPULATIONS,


SORTING AND SEARCHING

EXPT NO:04 MOVE A STRING DATE:


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.
f. Move the byte from DS TO ES, till CX=0.

START

Initialize DS,ES,SI,DI

CX=length of string,
DF=0.

Move a byte from source string (DS)


to destination string (ES)

Decrement CX

NO

Check for
ZF=1

STOP
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

MOVE A STRING

Address Mnemonics Opcode Commands


1000 MOV SI,2000 C7C60020 Move the 10c2000 to source Index

1004 MOV DI,2100 C7C70021 Move the 10c2100 to Destination Index


1008 MOV CX,0FF C7C1FF00 Move CX register
100C CLD FC clear
100D MOVSB A4 Move the Register

100E LOOP 100D E2FD Move to Loop

1010 HLT F4 Stop the Program.

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

18
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

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.
e. Scan for the byte in ES. If the byte is found ZF=0, move the address pointed by ES:DI
to BX.
START

Initialize DS,ES ,SI,DI

CX=length of the string,


DF=0.

Scan for a particular character


specified in AL Register.

NO

Check for
ZF=1

Move DI to BX

STOP

19
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

SEARCHING A STRING

ADDRESS OPCODES PROGRAM COMMENTS

1000 MOV DI,1300 Initialize destination address


1004 MOV SI, 1400 Initialize starting address
1008 MOV CX, 0006 Initialize array size
100C CLD Clear direction flag
100D MOV AL, 08 Store the string to be searched
1010 REPNE SCASB Scan until the string is found
1012 DEC DI Decrement the destination address
1013 MOV [SI],DI Store content of BL in source address
1015 HLT Stop

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

20
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

FIND AND REPLACE


AIM:
To find a character in the string and replace it with another character.

ALGORITHM:
a. Initialize the extra segment .(E S)
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.
e. Store the ASCII code of the character that has to replace the scanned byte in BL
register.
f. Scan for the byte in ES. If the byte is not found, ZF≠1 and repeat scanning.
g. If the byte is found, ZF=1.Move the content of BL register to ES:DI.
START

Initialize DS, ES, SI, DI

CX=length of the string in ES,


DF=0.

Scan for a particular character


specified in AL Register.

NO

Check for ZF=1

YES
Move the content of BL
to ES:DI

STOP

21
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

FIND AND REPLACE A CHARACTER IN THE STRING

ADDRESS OPCODES MNEMONICS COMMANDS

1000 MOV DI,1300 Initialize destination address

1004 MOV SI,1400 Initialize starting address


1008 MOV CX, 0006 Initialize array size
100C CLD Clear direction flag
100D MOV AL, 08 Store the string to be searched
1010 MOV BH,30 Store the string to be replaced
1013 REPNE SCASB Scan until the string is found
1015 DEC DI Decrement the destination address
1016 MOV BL,[DI] Store the contents into BL reg
1018 MOV [SI],BL Store content of BL in source address
101A MOV [DI],BH Replace the string
101C HLT Stop

RESULT:
Thus a given byte or word in a string of a particular length in the extra segment(destination)
is found and is replaced with another character.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

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.

23
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

FLOWCHART
ASCENDING ORDER DESCENDING ORDER

START
START

INITIALIZE POINTER INITIALIZE POINTER

COUNT = COUNT – 1 COUNT = COUNT – 1

YES
IS POINTER YES IS POINTER
POINTER POINTER

NO
NO

TEMP = POINTER
TEMP = POINTER POINTER = POINTER + 1
POINTER = POINTER + 1 POINTER + 1 = TEMP
POINTER + 1 = TEMP

POINTER = POINTER +1
POINTER = POINTER +1 COUNT = COUNT + 1
COUNT = COUNT + 1

NO NO
IS
IS

YES
YES

NO
IS FLAG
IS FLAG

YES
YES

STOP
STOP

24
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

ASCENDING

Address Label Mnemonics Opcode Commands


1000 MOV CL,05H C6C105 Move to CL
1003 MOV DL,CL 88CA Move CL to DL
1005 L1 DEC CL FEC9 Decrement CL
1007 L2 LEA BX,[1300] 8D1E0013 Result to BX
100B MOV AL,[BX] 8A07 Move BX content
100D CMPAL,[BX+1] 3A4701 Compare AL,BX+1
1010 JC1015 7203 Jump if carry
1012 L3 XCHG AL,[BX+1] 864701 Exchange source destination
1014 MOV[BX],AL 8807
1017 INC BX 43 Increment BX
1018 LOOP 100B E2F1 Loop 100B
101A DEC CL FEC9 Decrement CL
101C MOV CL,DL 88D1 Move DL to CL
101E LOOP 1007 E2F7 Loop 1007
1020 HLT F4 Stop the Program

DESCENDING

Address Label Mnemonics Opcode Commands


1000 MOV CL,05H C6C105 Move to CL
1003 MOV DL,CL 88CA Move CL to DL
1005 L1 DEC CL FEC9 Decrement CL
1007 L2 LEA BX,[1300] 8D1E0013 Result to BX
100B MOV AL,[BX] 8A07 Move BX content
100D CMPAL,[BX+1] 3A4701 Compare AL,BX+1
1010 JNC1015 7303 Jump if no carry
1012 L3 XCHGAL,[BX+1] 864701 Exchange source destination
1014 MOV[BX],AL 8807
1017 INC BX 43 Increment BX
1018 LOOP 100B E2F1 Loop 100B
101A DEC CL FEC9 Decrement CL
101C MOV CL,DL 88D1 Move DL to CL
101E LOOP 1007 E2F7 Loop 1007
1020 HLT F4 Stop the Program

RESULT:

Thus given array of numbers are sorted in ascending & descending order.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

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.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
FLOWCHART
LARGEST NUMBER IN AN ARRAY SMALLEST NUMBER IN AN ARRAY

START START

INITIALIZE
INITIALIZE
COUNT
COUNT

PONITER = PONITER =
POINTER + 1 POINTER + 1

YES
IS MAX IS MIN
POINTER
YES
NO NO

MAX = POINTER MIN = POINTER

COUNT = COUNT-1 COUNT = COUNT-1

NO NO

IS COUNT = 0 IS COUNT = 0
? ?
YES
YES
STORE MAXIMUM STORE MINIIMUM

STOP STOP

28
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

LARGEST

Address Label Mnemonics Opcode Commands

1000 MOV [SI],1200H 8D1E0013 Load data in offset


1004 MOV CL,[SI] 31FF Clear Data index
1006 INC SI C6C000 Move data 00 to AL
1009 MOV AL,[SI] C6C104 Move data 04 to CL
100C DEC CL 3A01 Compare AL,BX reg
100E INC SI 7304 Jump the data
1010 CMP AL,[SI] 8A11 Move DL to AL reg
1012 JNB 1012 88D0 Move DL to AX
1014 MOV AL,[SI] 47 Increment DI reg
1015 DEC CL FEC9 Decrement CL reg
1017 JNZ 100B 73F3 Jump if no zero
1019 MOV [DI],1300H 88060012 Move AL to 1200
101D MOV [DI],AL F4 Stop the Program
HLT
SMALLEST

Address Label Mnemonics Opcode Commands


1000 MOV [SI],1200H 8D1E0013 Load data in offset
1004 MOV CL,[SI] 31FF Clear Data index
1006 INC SI C6C000 Move data 00 to AL
1009 MOV AL,[SI] C6C104 Move data 04 to CL
100C DEC CL 3A01 Compare AL,BX reg
100E INC SI 7304 Jump the data
1010 CMP AL,[SI] 8A11 Move DL to AL reg
1012 JB 1012 88D0 Move DL to AX
1014 MOV AL,[SI] 47 Increment DI reg
1015 DEC CL FEC9 Decrement CL reg
1017 JNZ 100B 73F3 Jump if no zero
1019 MOV [DI],1300H 88060012 Move AL to 1200
101D MOV [DI],AL F4 Stop the Program
HLT

RESULT:
Thus the largest and smallest number is found in a given array.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

FLOATING POINT OPERATION

AIM:
To perform floating point operation using 8086 microprocessor Kit.

APPARATUS REQUIRED:
8086 Microprocessor Kit

PROGRAM:
ADDITON:

ADDRESS MNEMONICS OPCODE COMMANDS


1000 MOV AL,33 C6C033 Move 33 to AL
1003 MOV BL,66 C6C366 Move 66 to BL
1006 ADD AL,BL 00D8 ADD BL to AL
1008 MOV [1100],AL 88060011 Move AL to 1100
100C HLT F4 Stop the program

SUBTRACTION:

ADDRESS MNEMONICS OPCODE COMMANDS


1000 MOV AL,66 C6C033 Move 33 to AL
1003 MOV BL,33 C6C366 Move 66 to BL
1006 SUB BL,AL 28D8 SUB BL to AL
1008 MOV [1100],AL 88060011 Move AL to 1100
100C HLT F4 Stop the program

MULTIPLICATION:

ADDRESS MNEMONICS OPCODE COMMANDS


1000 MOV AL,33 C6C033 Move 33 to AL
1003 MOV BL,66 C6C366 Move 66 to BL
1006 MUL BX F7E3 SUB BL to AL
1008 MOV [1100],AH 88060011 Move AL to 1100
100C HLT F4 Stop the program

RESULT:
Thus the program for floating point operation are executed and the output was verified
success fully.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

PASSWORD CHECKING, PRINT RAM SIZE AND SYSTEM DATE

EXPT NO:05 DATE:


AIM:
To write an Assembly Language Program (ALP) for performing the Arithmetic
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

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
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:

31
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

MOV BX,00
MOV CX,LEN
CHECK:
MOV AL,[INST+BX]
MOV DL,[PASSWORD+BX]
CMP AL,DL
JNE FAIL
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

;Today.asm Display month/day/year.


; Feb 1st, 2012
;CIS 206 Ken Howard
.MODEL small
.STACK 100h
.DATA
mess1 DB 10, 13, 'Today is $' ; 10=LF, 13=CR
.CODE

Today PROC
MOV AX, @data
MOV DS, AX
MOV DX, OFFSET mess1 ; Move string to DX
MOV AH, 09h ; 09h call to display string (DX > AH > DOS)
INT 21H ; Send to DOS
; CX year, DH month, DL day
MOV AH, 2AH ; Get the date (appendix D)
INT 21H ; Send to DOS
PUSH CX ; Move year to the stack
MOV CX, 0 ; Clear CX

MOV CL, DL
PUSH CX ; Move day to stack
MOV CL, DH ; Move month > CL
PUSH CX ; Move month to stack
MOV DH, 0 ; Clear DH
; ************************** DISPLAY MONTH ************************

32
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

; Set up for division


; Dividend will be in DX/AX pair (4 bytes)
; Quotient will be in AX
; Remainder will be in DX
MOV DX, 0 ; Clear DX
POP AX ; Remove month from stack into AX
MOV CX, 0 ; Initialize the counter
MOV BX, 10 ; Set up the divisor
dividem:
DIV BX ; Divide (will be word sized)
PUSH DX ; Save remainder to stack
ADD CX, 1 ; Add one to counter
MOV DX, 0 ; Clear the remainder
CMP AX, 0 ; Compare quotient to zero
JNE dividem ; If quoient is not zero, go to "dividem:"
divdispm:

POP DX ; Remove top of stack into DX


ADD DL, 30h ; ADD 30h (2) to DL
MOV AH, 02h ; 02h to display AH (DL)
INT 21H ; Send to DOS
LOOP divdispm ; If more to do, divdispm again
; LOOP subtracts 1 from CX. If non-zero, loop.
MOV DL, '/' ; Character to display goes in DL
MOV AH, 02h ; 02h to display AH (DL)
INT 21H ; Send to DOS
; ************************** DISPLAY DAY ************************
; Set up for division
; Dividend will be in DX/AX pair (4 bytes)
; Quotient will be in AX
; Remainder will be in DX
MOV DX, 0 ; Clear DX
POP AX ; Remove day from stack into AX
MOV CX, 0 ; Initialize the counter
MOV BX, 10 ; Set up the divisor
divided:
DIV BX ; Divide (will be word sized)
PUSH DX ; Save remainder to stack

ADD CX, 1 ; Add one to counter


MOV DX, 0 ; Clear the remainder
CMP AX, 0 ; Compare quotient to zero
JNE divided ; If quoient is not zero, go to "divided:"
divdispd:
POP DX ; Remove top of stack ADD
DL, 30h ; ADD 30h (2) to DL MOV AH,
02h ; 02h to display AH (DL) INT 21H
; Send to DOS
LOOP divdispd ; If more to do, divdispd again
; LOOP subtracts 1 from CX. If non-zero, loop.

33
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

MOV DL, '/' ; Character to display goes in DL


MOV AH, 02h ; 02h to display AH (DL)
INT 21H ; Send to DOS
; ************************** DISPLAY YEAR ************************
; Set up for division
; Dividend will be in DX/AX pair (4 bytes)
; Quotient will be in AX
; Remainder will be in DX
MOV DX, 0 ; Clear DX
POP AX ; Remove month from stack into AX
MOV CX, 0 ; Initialize the counter
MOV BX, 10 ; Set up the divisor
dividey:
DIV BX ; Divide (will be word sized)
PUSH DX ; Save remainder to stack
ADD CX, 1 ; Add one to counter
MOV DX, 0 ; Clear the remainder
CMP AX, 0 ; Compare quotient to zero
JNE dividey ; If quoient is not zero, go to "dividey:"
divdispy:
POP DX ; Remove top of stack into DX
ADD DL, 30h ; ADD 30h (2) to DL
MOV AH, 02h ; 02h to display AH (DL)
INT 21H ; Send to DOS
LOOP divdispy ; If more to do, divdisp again
; LOOP subtracts 1 from CX. If non-zero, loop.
MOV al, 0 ; Use 0 as return code
MOV AH, 4ch ; Send return code to AH
INT 21H ; Send return code to DOS to exit.

Today ENDP ; End procedure


END Today ; End code. Start using "Today" procedure.
MVI A, 80H: Initialize 8255, port A and port B
OUT 83H (CR): in output mode
START: MVI A, 09H
OUT 80H (PA): Send data on PA to glow R1 and R2
MVI A, 24H
OUT 81H (PB): Send data on PB to glow G3 and G4
MVI C, 28H: Load multiplier count (40ıο) for delay
CALL DELAY: Call delay subroutine
MVI A, 12H
OUT (81H) PA: Send data on Port A to glow Y1 and Y2
OUT (81H) PB: Send data on port B to glow Y3 and Y4
MVI C, 0AH: Load multiplier count (10ıο) for delay
CALL: DELAY: Call delay subroutine
MVI A, 24H
OUT (80H) PA: Send data on port A to glow G1 and G2
MVI A, 09H
OUT (81H) PB: Send data on port B to glow R3 and R4
MVI C, 28H: Load multiplier count (40ıο) for delay

34
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

CALL DELAY: Call delay subroutine


MVI A, 12H
OUT PA: Send data on port A to glow Y1 and Y2
OUT PB: Send data on port B to glow Y3 and Y4
MVI C, 0AH: Load multiplier count (10ıο) for delay
CALL DELAY: Call delay subroutine
JMP START
Delay Subroutine:
DELAY: LXI D, Count: Load count to give 0.5 sec delay
BACK: DCX D: Decrement counter
MOV A, D
ORA E: Check whether count is 0
JNZ BACK: If not zero, repeat
DCR C: Check if multiplier zero, otherwise repeat
JNZ DELAY
RET: Return to main program

Ram size:

ORG 0000H
CLR PSW3
CLR PSW4
CPL A
ADD A, #01H
MOV A,R3
AGAIN: SJMP AGAIN

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

35
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

Counters and Time Delay

EXP.NO: 06 DATE:

AIM:

To interface the programmable interval timer to generate square wave with 8086 microprocessor
kit.

APPARATUS REQUIRED:

S.No Description Quantity

1. Microprocessor trainer kit-8086 1

2. Power Chord 1

3. Programmable Interval Timer kit 1

4. CRO 1

PROCEDURE:
1.The microprocessor kit was switched on.
2.The opcode for the program was entered into the microprocessor kit.
3.The program was executed and output square was verified in CRO.

PROGRAM:

ADDRESS LABEL OPCODE MNEMONICS COMMANDS

1000 B0,B7 MOV AL,B7 Timer is initialized with counter 2 in Mode3

1002 BA,16,FF MOV DX,FF16 Control Port address in DX

1005 EE OUT DX,AL Send the data to the timer

1006 B0,02 MOV AL,02 Load LSB count in AL

1008 BA,10,FF MOV DX,FF10 Port address in DX

100B EE OUT DX,AL Output the AL contents to CLK 2

100C B0,00 MOV AL,00 Load MSB count in the AL

100E BA,10,FF MOV DX,FF10

1011 EE OUT DX,AL Output the AL content to CLK2

1012 CC INT 3 Breakpoint


EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

RESULT:
Thus the programmable interval timer was interfaced to generate square wave with 8086
microprocessor kit.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

INTERFACING AND PROGRAMMING OF 8279 WITH 8086 DISPLAY A CHARACTER

EXP.NO: 07 DATE
AIM:
To interface 8279 Microprocessor to display A character using microprocessor 8086.
APPARATUS REQUIRED:

S.No Description Quantity

1. Microprocessor trainer kit-8086 1

2. Power Chord 1

3. Programmable Interval Timer kit 1

4. CRO 1

Program to Display A in the first digit Description:


To write a program to display ‘A’ in the first digit of a display by interfacing.
Algorithm:
 Start the Program.
 Move AL reg to OUT C2.
 Move AL reg again to OUT C2.
 Move data 90 to AL Reg.
 Move the content of AL reg to output C2.
 Move the value 88 to AL Reg.
 Move 0005 to CX Reg.
PROGRAM:
ADDRESS LABEL OPCODE MNEMONICS COMMANDS

1000 Start Mov AL,00 AL < - 00

1003 OUT C2,AL C2 < - AL

1005 MOV AL,OCC AL < - CC

1008 OUT C2,AL C2 < - AL

100A MOV AL,90 AL < - 90

100D OUT C2,AL C2 < - AL

MOV AL,88 AL < - 88

1012 OUT C0,AL C0 < - AL

1014 MOV AL,OFF AL < - FF

1017 MOV CX,005 CX < - 0005


EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
1018 OUT C0,AL C0 < - AL

101D Loop 101B LOOP NEXT

HLT End

RESULT:
Thus the program to display ‘A’ in the first digit of a display by interfacing 8279 with 8086
was complemented and the output was verified.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

TRAFFIC LIGHT CONTROL

EXP.NO: 07 DATE:

AIM:
To write an assembly language program in 8086 to Traffic light control
APPARATUS REQUIRED:
SL.NO ITEM SPECIFICATION QUANTITY
1. Microprocessor kit 8086 1
2. Power Supply +5 V, dc,+12 V dc 1
3. Traffic light control Interface - 1
board

THEORY:

The board is a simple contraption of a traffic control systems wherein the signalling
light are simulated by the blinking or ON-OFF control of light emitting diodes. The signalling
lights for the pedestrian crossing are simulated by the ON-OFF control of dual colour light
emitting. A Model of a four road four lane junction, the board has green, yellow and red LEDs
which are the green, orange and the red signals of an actual system. Twenty LEDs are used on
the board. In additional eight dual colour LEDs are used which can be made to change either to
red or to green.
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
PROGRAM:

CONTRL EQU 026H PORTA EQU 020H


PORTB EQU 022H PORTC EQU 024H

1000 ORG 1000H


1000 START:
1000 BB 00 11 MOV BX,1100H
1003 B9 00 0C MOV CX,000CH
1006 8A 07 MOV AL,[BX]
1008 E6 26 OUT 026,AL
100A 43 INC BX
100B NEXT:
100B 8A 07 MOV AL,[BX]
100D E6 20 OUT 020,AL
100F 43 INC BX
1010 8A 07 MOV AL,[BX]
1012 E6 22 OUT 022,AL
1014 E8 07 00 CALL 101E
1017 43 INC BX
1018 E2 F1 LOOP 100D
101A EB E4 JMP 1000
101C DELAY:
101C 51 PUSH CX
101D B9 00 05 MOV CX,0500H
1020 REPEAT:
1020 BA FF FF MOV DX,0FFFFH
1023 LOOP2:
1023 4A DEC DX
1024 75 FD JNZ 1028
1026 E2 F8 LOOP 1024
1028 59 POP CX
1029 C3 RET
1100 ORG 1100H
1100 80 1A A1 64 A4 DB 80H,1AH,0A1H,64H,0A4H
1105 81 5A 64 54 8A DB 81H,5AH,64H,54H,8AH
110A B1 A8 B4 88 DB 0B1H,0A8H,0B4H,88H
110E DA 68 D8 1A E8 DB 0DAH,68H,0D8H,1AH,0E8H
1113 46 E8 83 78 86 74 DB 46H,0E8H,83H,78H,86H,74H
1119 CODE ENDS
END

RESULT:

Thus traffic light control was executed.

39
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

STEPPER MOTOR INTERFACING

EXP.NO: 08 DATE:

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

40
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

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

IS B = 0 ?

GET THE DATA FROM LOOK UP

PROGRAM :

ADDRESS LABEL MNEMONICS OPCODE COMMANDS


1000 START MOV DI,1050 C7C50100 Move the content to DI
1004 MOVCL,04 C6C104 Move the count value to CL
1007 LOOP1 MOVAL,[DI] 8A05 Move the content of destination to AL
1009 OUT 0C0,AL E6C0 Out the content of AL to C0 port
100B MOV DX,1010 C1C2100 Move the content to DX
100E L2 DEC DX 4A Decrement DX
1010 JNZ L2 (100F) 76FD Jump if Not Zero to location
1012 INC DI 47 Increment DI
1013 LOOP1 (1007) E2F2 Get into Loop
1015 JMP START F4 Jump to Start location

RESULT:
Thus the assembly language program for rotating stepper motor in both clockwise and
anticlockwise directions is written and verified.
41
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

DIGITAL CLOCK

EXP.NO: 09 DATE:

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:

42
EC6413 – MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE

43
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

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.

44
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

INTERFACING PRGRAMMABLE KEYBOARD AND


DISPLAY CONTROLLER- 8279

EXP.NO:10 DATE:

AIM:
To display the rolling message “HELP US “in the display.

APPARATUS REQUIRED:
8086 Microprocessor kit, Power supply, Interfacing board.

ALGORITHM:
Display of rolling message “HELP US “
1. Initialize the counter
2. Set 8279 for 8 digit character display, right entry
3. Set 8279 for clearing the display
4. Write the command to display
5. Load the character into accumulator and display it
6. Introduce the delay
7. Repeat from step 1.

1. Display Mode Setup: Control word-10 H

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

DD
00 - 8Bit character display left entry
01 - 16Bit character display left entry
10 - 8Bit character display right entry
1 1- 16Bit character display right entry
KKK- Key Board Mode
000 - 2Key lockout.
2.Clear Display: Control word-DC H

1 1 0 1 1 1 0 0
1 1 0 CD CD CD CF CA

11 A0-3; B0-3 =FF

1-Enables Clear display


0-Contents of RAM will be displayed
1-FIFO Status is cleared

1-Clear all bits 45


(Combined effect of CD)
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

3. Write Display: Control word-90H

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

Selects one of the 16 rows of display.

Auto increment = 1, the row address selected will be incremented after each of read and
write operation of the display RAM.

FLOWCHART:

SEGMENT DEFINITION:

DATA BUS D7 D6 D5 D4 D3 D2 D1 D0

SEGMENTS d c b a dp g f e

46
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

PROGRAM:

ADDRESS LABEL MNEMONICS COMMANDS


1000 START MOV SI,1200 Initialize array value
1004 MOV CX,000F Initialize array size
1008 MOV AL,10 Store the control word for display mode
100B OUT C2,AL Send through output port
100D MOV AL,0CC Store the control word to clear display
1010 OUT C2,AL Send through output port
1012 MOV AL,90 Store the control word to write display
1015 OUT C2,AL Send through output port
1017 L1 MOV AL,[SI] Get the first data
1019 OUT C0,AL Send through output port
101B CALL L2 (1500) Give delay
101E INC SI Go & get next data
101F LOOP L1( 1017) Loop until all the data’s have been taken
1021 JMP START(1000) Go to starting location
1500 L2 MOV DX,0A0FFH Store 16bit count value
1504 L3 DEC DX Decrement count value
1505 JNZ L3(1504) Loop until count values becomes zero
1507 RET Return to main program

LOOK-UP TABLE:

1200 98 68 7C C8
1204 FF 1C 29 FF

RESULT:

MEMORY 7-SEGMENT LED FORMAT HEX DATA


LOCATION d c b a dp e g f
1200H 1 0 0 1 1 0 0 0 98
1201H 0 1 1 0 1 0 0 0 68
1202H 0 1 1 1 1 1 0 0 7C
1203H 1 1 0 0 1 0 0 0 C8
1204H 1 1 1 1 1 1 1 1 FF
1205H 0 0 0 0 1 1 0 0 1C
1206H 0 0 1 0 1 0 0 1 29
1207H 1 1 1 1 1 1 1 1 FF

RESULT:

Thus the rolling message “HELP US” is displayed using 8279 interface kit.

47
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

PRINTER STATUS

EXP.NO:11 DATE:

AIM:
To display the Printer Status in the display

APPARATUS REQUIRED:
8086 Microprocessor kit, Power supply, Interfacing board.

PROGRAM:

XOR AX, AX
XOR BX, BX
;this divides my 3digit number by 100 giving me my, hundredth digit
MOV AX, RES
MOV BX, 100
DIV BX;prints the hundredth digit
ADD AL, '0'
MOV DL, AL
PUSH AX ; save AX on the stack
MOV AH, 02h
INT 21h
POP AX ; restore ax
;divides the remainder by 10 giving me my tens digit
MOV BX, 10
DIV BX
;prints my tens digit
ADD AL, '0'
MOV DL, AL
PUSH AX ; save AX on the stack
MOV AH, 02h
INT 21h
POP AX ; restore ax
;print my last remainder which is my ones
ADD AH, '0'
MOV DL, AH
MOV AH, 02h
INT 21h

RESULT:
Thus the output for the status of printer was executed successfully.
48
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

SERIAL INTERFACE AND PARALLEL INTERFACE

EXP.NO: 12 DATE:
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 number 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 Program:

49
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
Receiver Program:

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.

50
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
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:
ADDRESS MNEMONICS OPCODE COMMANDS

MOV AL,80
OUT 26,AL
MOV AL,04
OUT 20,AL
MOV AL,06
OUT 22,AL
HLT

Receiver Program:
ADDRESS MNEMONICS OPCODE COMMANDS

MOV AL,92
MOV AL,26
IN AL,20
MOV [SI],1500
MOV [SI],AL
IN AL,22
MOV [SI],1502
MOV [SI],AL
HLT

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.

51
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

A/D AND D/A INTERFACE AND WAVEFORM GENERATION

EXPT NO:13 DATE:


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

52
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
PROGRAM:

ADDRESS MNEMONICS OPCODE COMMANDS

1000 MOV AL,10 C61010 Move 10 to AL


1003 OUT C8,AL E6C8 Out the AL content to C8 port
1005 MOV AL,18 C6C018 Move 18 to AL register
1008 OUT C8,AL E6C8 Out the AL content to C8 port
100A HLT F4 Stop the Program

RESULT:
ANALOG DIGITAL DATA ON LED HEX CODE IN MEMORY
VOLTAGE DISPLAY LOCATION

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

53
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
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.
(vi) The above procedure is repeated from step (i)

54
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
FLOWCHART:
MEASUREMENT OF ANALOG VOLTAGE: SQUARE WAVE FORM:

START

START

SEND THE INTIALISE THE


DIGITALVALUE TO ACCUMULATOR SEND ACC
ACCUMULATOR

DELAY

TRANSFER THE
ACCUMULATOR
LOAD THE ACC WITH MAX
VALUE SEND ACC CONTENT
LOAD THE
CORRESSPONDING VALUE DELAY

STOP

55
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

SAW TOOTH: TRIANGULAR:

START
START

INITIALIZE
INITIALIZE
ACCUMULATOR
ACCUMULATOR

SEND ACC
SEND CONTENT TO DAC
ACCUMULATOR

INCREMENT INCREMENT
ACCUMULATOR ACCUMULATOR

NO
IS ACC ≤
IS FF
ACC≤FF

DECREMENT
ACC CONTENT

SEND ACC

YES
IS
ACC≤00

56
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
MEASUREMENT OF ANALOG VOLTAGE:
PROGRAM : SQUARE WAVE:

ADDRESS LABEL MNEMONICS OPCODE COMMANDS

L2 MOV AL,00H

L1 OUT C8,AL
CALL L1
MOV AL,0FFFH
OUT C8,AL
CALL L1
JMP L2
L1 : MOV CX,05FFH
L3 L3 : LOOP L3
RET

PROGRAM : SAWTOOTH WAVE:

ADDRESS LABEL MNEMONICS OPCODE COMMANDS

1000 L2 MOV AL,00 C6C00


1003 L1 OUT C0,AL F6C0
1005 INC AL FEC0

1007 JNZ L1 75FA


1009 JMP L2 9F4FF
100C HLT F4

PROGRAM : TRIANGULAR WAVE:

ADDRESS LABEL MNEMONICS OPCODE COMMANDS

L3 L3 : MOV BL,00
MOV AL,BL
L1 L1 : OUT C8,AL
INC BL
JNZ L1
MOV BL,0FFH
MOV AL,BL
L2 L2 : OUT C8,AL
DEC BL
JNZ L2
JMP L3

57
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

RESULT:WAVEFORM GENERATION:

WAVEFORMS AMPLITUDE TIME PERIOD

Square waveform
Saw-tooth waveform

Triangular waveform

MODEL GRAPH:

Square Waveform Saw-tooth waveform

Triangular waveform

RESULT:

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

58
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

INTERFACING AND PROGRAMMING OF 8253 WITH 8086

AIM:
To generate a square wave by interfacing 8253 with 8086.

APPARATUS REQUIRED:
8086 Microprocessor kit, Power supply, Interfacing board, CRO.

SQUARE WAVE GENERATOR:


DESCRIPTION:
To generate a square wave of interfacing 8253 with 8086.

ALGORITHM:
 Move the number into AL register
 Set the control register and data register
 Then the channels are to be selected.
 Move the value 10 into AL register
 Move the value 00 into AL register
 Stop the program.

PROGRAM:

ADDRESS MNEMONICS OPCODE COMMANDS

1000 MOV AL,36 C6C036 Move 36 to AL


1003 OUT OCE,AL E6CE Out the AL register content to port CE
1005 MOV AL,18 C6C018 Move 18 to AL
1008 OUT C8,AL E6C8 Out the AL register content to port C8
100A MOV AL,00 C6C000 Move 00 to AL
100D OUT C8,AL E6C8 Out the AL register content to port CE
100F HLT F4 Stop the Program

RESULT:
Thus the square wave was generated by interfacing 8253 with 8086 of the output was verified
successfully.

59
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

TRANSMISSION AND RECEPTION USING 8251

AIM:

To initiate 8251 and to check the transmission and reception of a character.

APPARATUS REQUIRED:
8086 Microprocessor kit, Keyboard, 8251/8253 Interface kit.

ALGORITHM:

TRANSMISSION:

 Start the program.


 Set the mode at 8253 of giving control word 30,IN,OUT instruction.
 Set the mode of 8251 for command instruction using data 4E and OUT instruction.
 Send the data through OUT CO.
 Given OUT instruction for calling a sub program.
 Store the data in memory.

RECEPTION:

 Obtain the data send by the transmission by IN instruction.


 Store the data obtained in memory.
 Stop the program.
PROGRAM:
Check for TX empty then send data 41 to 8251

ADDRESS LABEL MNEMONICS OPCODE COMMANDS

1000 LOOP IN AL,OA E40A Move 0A to AL


1002 TEST AL,04 F6C004 Test 04 to AL
1005 JZ Loop (1000) 74F9 Jump if Zero to location
1007 MOV AL,41 C6C041 Move 41 to AL
100A OUT C8,AL E608 Out the value of AL to port C8

60
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

Check for RX GET DATA, Store data at 1100:

ADDRESS LABEL MNEMONICS OPCODE COMMANDS

100C LOOP1 IN AL,OA E404 Move 0A to AL


100E TEST AL,02 E6C002 Test 02 to AL
1011 JZ Loop1(1200) 74F9 Jump the loop1
1013 IN AL,08 E408 Move 08 to AL
1015 MOV [1100],AL 88060011 Move 1100 to AL
1019 HLT F4 Stop the program

RESULT:
Thus the transmission and reception of a character was initialized and checked.

61
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

BASIC ARITHMETIC AND LOGICAL OPERATIONS OF 8051

EXPT NO:14 DATE:

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.

FLOW CHART:

START

Clear PSW

Select Register

Load A and R 0
with 8- bit data

Add A & R 0

Store the sum

STOP

62
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
8 BIT ADDITION (IMMEDIATE ADDRESSING):

ADDRESS LABEL MNEMONIC HEX COMMANDS


CODE
4100 MOV A, # data 1 74,data1 Get the data1 in Accumulator
4101 ADD B, # data 2 24,data2 Add the data1 with data2

4103 MOV DPTR, #4500H 90,45,00 Initialize the memory location

4105 MOVX @ DPTR, A F0 Store the result in memory location

4108 L1 SJMP L1 80,FE Stop the program

OUTPUT
MEMORY LOCATION DATA

4500

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

63
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
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.
f. Store the result in memory.

FLOWCHART:
START

CLEAR CARRY
FLAG

GET FIRST
OPERAND IN
ACCR

SUBTRACT THE
SECOND OPERAND
FROM ACC

N
IS CF=1

Y
INCREMENT
THE BORROW
REGISTER

STORE
RESULT IN
MEMORY

STOP

64
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
8 BIT SUBTRACTION (IMMEDIATE ADDRESSING):

ADDRESS LABEL MNEMONIC HEX COMMANDS


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.

65
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

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.

FLOWCHART:

START

GET
MULTIPLIER
IN ACCR

GET
MULTIPLICAND
IN B REG

MULTIPLY A
WITH B

STORE
RESULT IN
MEMORY

STOP

66
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
8 Bit Multiplication
ADDRESS LABEL MNEMONIC HEX COMMANDS
CODE
4100 MOVA ,#data1 74, data1 Store data1 in accumulator

4102 MOV B, #data2 75,data2 Store data2 in B reg

4104 MUL AB F5,F0 Multiply both

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

4109 MOVX@ DPTR, A F0 Store lower order result

401A INC DPTR A3 Go to next memory location

410B MOVA,B E5,F0


Store higher order result
410D MOV@ DPTR, A F0

410E STOP SJMP 410E 80,FE Stop

OUTPUT:

INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA

4500 4502

4501 4503

RESULT:

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

67
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

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.

FLOWCHART:

START

GET DIVIDEND
IN ACCR

GET DIVISOR IN
B REG

DIVIDE A BY B

STORE
QUOTIENT &
REMAINDER
IN MEMORY

STOP

68
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
8 Bit Division

ADDRESS LABEL MNEMONIC HEX COMMENTS


CODE
4100 MOV A, # data1 74,data1

4102 MOV B, # data2 75,data2

4104 DIVA,B 84

4015 MOV DPTR, # 4500H 90,45,00

4018 MOVX @ DPTR, A F0

4109 INC DPTR A3

410A MOV A,B E5,F0

410C MOV X@ DPTR, A F0

410D STOP SJMP HERE 80,FE

OUTPUT:

INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
4500 (dividend) 4502 (remainder)

4501 (divisor) 4503 (quotient)

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

69
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
LOGICAL AND BIT MANIPULATION
AIM:

To write an ALP to perform logical and bit manipulation operations using 8051
microcontroller.

APPARATUS REQUIRED:
8051 microcontroller kit

ALGORITHM:

1. Initialize content of accumulator as FFH


2. Set carry flag (cy = 1).
3. AND bit 7 of accumulator with cy and store PSW format.
4. OR bit 6 of PSW and store the PSW format.
5. Set bit 5 of SCON.
6. Clear bit 1 of SCON.
7. Move SCON.1 to carry register.
8. Stop the execution of program.

FLOWCHART:

START

Set CY flag, AND CY with MSB of

Store the PSW format, OR CY with bit 2 IE reg

Clear bit 6 of PSW, Store PSW

Set bit 5 of SCON , clear bit 1 and store


SCON

Move bit 1 of SCON to CY and store PSW

STOP

70
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
PROGRAM :

AND OPERATION:

ADDRESS OPCODE MNEMONICS COMMENT

4100 MOV A,#87H

4102 ANL A,#7EH

4104 MOV DPTR,#4500H

4107 MOVX@ DPTR,A

4108 SJMP here

OR OPERATION:

ADDRESS OPCODE MNEMONICS COMMENT

4100 MOV A,#87H

4102 ORL A,#7EH

4104 MOV DPTR,#4500H

4107 MOVX@ DPTR,A

4108 SJMP here

EXOR OPERATION:

ADDRESS OPCODE MNEMONICS COMMENT

4100 MOV A,#87H

4102 XORL A,#7EH

4104 MOV DPTR,#4500H

4107 MOVX@ DPTR,A

4108 SJMP here

RESULT:
Thus the bit manipulation operation is done in 8051 microcontroller.

71
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

Square and Cube program, Find 2’s complement of a number

EXPT NO: 15 DATE:

AIM:
To perform the square, cube & two’s complement operations in 8051.

APPARATUS REQUIRED:

S.No Description Quantity

1. Microcontroller trainer kit-8051 1

2. Power Chord 1

PROCEDURE:
1.The microprocessor kit was switched on.
2.The opcode for the program was entered into the microprocessor kit.
3.The program was executed and output was verified.

SQUARE :

ADDRESS OPCODE LABEL MNEMONICS COMMENT

9000 MOV A #05

MOV B,A

MUL AB

MOV DPTR,#4500

MOVX @DPTR,A

INC DPTR

MOV A,B

MOVX @ DPTR,A

SJMP HERE

72
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB :
CUBE

ADDRESS OPCODE LABEL MNEMONICS COMMENT

9000 MOV A,# 03

MOV B,A

MOV DPTR,#4400

MOVX @DPTR,A

MUL AB

MOV B,A

MOVX A,@DPTR

MUL AB

MOV DPTR,#4500

INC DPTR

MOVX @DPTR,A

SJMP HERE

TWO’S COMPLEMENT:

ADDRESS OPCODE LABEL MNEMONICS COMMENT

9000 MOV DPTR,#9100H

MOVX A,@DPTR

CPL A

ADD A,#01

INC DPTR

MOVX @ DPTR,A

SJMP HERE

RESULT:

The basic square, cube & two’s complement operations was done on 8051 microcontroller and
output was verified.

73
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

Unpacked BCD to ASCII

EXPT NO:16 DATE:

AIM:
To convert BCD number into ASCII by using 8051 micro controller

RESOURCES REQUIERED:
8051 microcontroller kit
Keyboard
Power supply

74
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB

FLOWCHART:

PROGRAM:

ADDRESS OPCODE MNEMONICS COMMENT

4100 MOV A,#07H Move Data 07 to register

4102 ADD A,#30 Move 30 to register

4104 MOV DPTR,#4500H Allocate the memory to DPTR

4107 MOVX@ DPTR,A Move A to DPTR

4108 SJMP 4108 Stop the Program

RESULT:
The given number is converted into ASCII using 8051 microcontroller kit.

75
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
52

58

66-76

76

You might also like