0% found this document useful (0 votes)
73 views134 pages

Eee - MP MC Lab Manual

Microprocessor manual

Uploaded by

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

Eee - MP MC Lab Manual

Microprocessor manual

Uploaded by

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

SYLLABUS

EE2356 MICROPROCESSOR ANDMICROCONTROLLERLABORATORY


LTPC
0032

8-bitMicroprocessor

1. Simplearithmeticoperations:Multi precisionaddition/subtraction/multiplication
/division.
2. Programmingwithcontrol instructions:Increment/Decrement,Ascending/
Descendingorder,Maximum /Minimum ofnumbers,Rotateinstructions
Hex/ASCII/BCDcodeconversions.
3. A/DInterfacing.
4. D/AInterfacing.
5. Trafficlightcontroller Interfacing
6. Steeper MotorInterfacing
7. Simpleexperimentsusing8251,8279,8254.

16-bit Microprocessor

8. Simplearithmeticoperations:Multi Precisionaddition /substraction/


multiplication/division.

8-bitMicrocontroller

9. Demonstrationofbasicinstructionswith8051 Microcontrollerexecution,
including:
a. Conditionaljumps,looping
b. Callingsubroutines.
c. Stackparameter testing
10. InterfacingKeyboardandDisplay
11. Steeptermotor Interfacing\
a. D/AInterfacing
b. Trafficlightcontroller Interfacing
c. 8051basedSerialPortCommunication.

TOTAL:45PERIODS
LIST OF EXPERIMENTS

1. 8-bit addition and subtraction using 8085 microprocessor


2. 8-bit multiplication and division using 8085 microprocessor
3. 16-bit addition and subtraction using 8085 microprocessor
4. Searching a largest number and smallest number in array of numbers
5. Sorting of numbers in ascending order and descending order.
6. Hex/ASCII/BCD code conversions
7. 32-bit addition and subtraction using 8086 microprocessor
8. 16-bit multiplication and division using 8086 microprocessor
9. 16-bit addition using 8051 microcontroller
10. 16-bit subtraction using 8051 microcontroller
11. 16-bit multiplication using 8051 microcontroller
12. 16-bit division using 8051 microcontroller
13. Interfacing ADC with 8085
14. Interfacing DAC with 8085
15. Traffic light controller using 8085
16. Stepper motor interfacing using 8085
17. Interfacing 8251/8254 with 8085
18. Interfacing 8279 with 8085
19. Interfacing Keyboard and Display with 8051
20. Interfacing D/A converter with 8051
21. Interfacing traffic light controller with 8051
22. Interfacing stepper motor with 8051
23. 8051 based serial port communication

MP & MC – LAB MANUAL ECE Page | 2


Ex. No: 1 8-BIT ADDITION AND SUBTRACTION USING 8085

AIM:
To perform addition and subtraction of two 8-bit numbers using 8085
microprocessor.

APPARATUS REQUIRED:
• 8085 Microprocessor Kit
• Power Chord

8-BIT ADDITION:

ALGORITHM:
Step1: Start the program.
Step2: Load the accumulator with the content of the memory location.
Step3: Move the content of accumulator to register B.
Step4: Load the accumulator with content of memory location.
Step5: Add the content of A with register B.
Step6: Store the content of accumulator in to memory location.
Step7: Stop the program.

MNEMONICS:
MVI C,00H LXI
H,4200H MOV
A,M INX H
MOV B,M ADD
B JNC XX
INR C

XX STA 4202H
MOV A,C
STA 4203H
HLT

TABLE 1:
MP & MC – LAB MANUAL ECE Page | 3
Mnemonics HEX Description
Memory Label
Instruction Operand CODE
4100 MVI C,00H 0E Move the value 00 to reg C
4101 00
4102 LXI H,4200H 21 Load the value in HL pair.
4103 00
4104 42
4105 MOV A,M 7E Move the content of memory to
reg A
4106 INX H 23 Increment the memory
location.
4107 MOV B,M 46 Move the content of memory to
reg B
4108 ADD B 80 Add content of B reg to
accumulator
4109 JNC XX D2 If there is no carry jump to XX
410A 0D
410B 41
410C INR C 0C Increment value to reg c
410D XX STA 4202H 32 Store the content of
accumulator in memory 4202
410E 02
410F 42
4110 MOV A,C 79 Move the content of c reg to
accumulator

MP & MC – LAB MANUAL ECE Page | 4


4111 STA 4203H 32 Store the content of
accumulator in memory 4203
4112 03
4113 42
4114 HLT 76 Halt the execution

OUTPUT (WITHOUT CARRY):

INPUT DATA: OUTPUT DATA:


4200: 06 4202: 08
4201: 02 4203: 00

OUTPUT (WITH CARRY):

INPUT DATA: OUTPUT DATA:


4200: FF 4202: FE
4201: FF 4203: 01

MP & MC – LAB MANUAL ECE Page | 5


8-BIT SUBTRACTION:

ALGORITHM:
Step1: Load the accumulator with content of memory location
Step2: Move the content of accumulator to B reg
Step3: Load the accumulator with the content of memory location
Step4: Subtract the content of A with reg B
Step5: Store the content of accumulator into memory location
Step6: Stop the program

MNEMONICS:

MVI C,00
LXI H,4200H
MOV A,M
INX H
MOV B,M
SUB B
JNC XX
INR C
CMA
INR A
XX: STA 4202H
MOV A,C
STA 4203H
HLT

MP & MC – LAB MANUAL ECE Page | 6


TABLE 2:

Mnemonics HEX Description


Memory Label
Instruction Operand CODE
4100 MVI C,00 0E Move the value 00 to reg c
4101 00
4102 LXI H,4200H 21 Load the value in HL reg pair
4103 00
4104 42
4105 MOV A,M 7E Move the content of memory to
accumulator
4106 INX H 23 Increment the HL register pair
4107 MOV B,M 46 Move the content memory to reg
B
4108 SUB B 90 Sub reg B from accumulator
4109 JNC XX D2 Jump to label XX if no carry
410A 0F
410B 41
410C INR C 0C Increment the C reg
410D CMA 2F Take 1’s complement for
accumulator
410E INR A 3C Add 1’s complement with 1
410F XX STA 4202H 32 Store the accumulator content in
4202H
4110 02

4111 42

4112 MOV A,C 79 Move the content of C reg to A


4113 STA 4203H 32 Store the accumulator content in
4203H
03
4114 42
4115
4116
HLT 76 Halt the execution
MP & MC – LAB MANUAL ECE Page | 7
OUTPUT (WITHOUT BORROW):

INPUT DATA: OUTPUT DATA:


4200:05 4202:02
4201:03 4203:00

OUTPUT (WITH BORROW):

INPUT DATA: OUTPUT DATA:


4200:14 4202:75
4201:89 4203:01

RESULT:
Thus the addition and subtraction of two 8-bit numbers using 8085
microprocessor was performed successfully

MP & MC – LAB MANUAL ECE Page | 8


Ex. No: 2 8-BIT MULTIPLICATION AND DIVISION USING 8085

MP & MC – LAB MANUAL ECE Page | 9


AI
M:
To write an assembly language program to divide and
multiply two 8 bit data’s using 8085
microprocessor kit.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit


• Power Chord

ALGORITHM:
Step1: Start the program.
Step2: Move immediately the data 00H to B register
and load 8 bit data from memory to accumulator.
Step3: Move the
accumulator content to C
register. Step4: Load
another 8 bit data in HL
pair.
Step5: Compare accumulator content with C register
content. If equal Zero Flag gets affected.
Step6: If A<C then carry gets affected.
Step7: Increment B register content once and
subtract C register content from
accumulator.
Step8: Goto Step 5.
Step9: Store the accumulator
data in specified memory.
Step10: Move data from ‘B’
register to accumulator. Step11:
Store the accumulator data in
specified memory.
Step12: End.
MP & MC – LAB MANUAL ECE Page | 18
MNEMONICS:
MVI B, 00H
LDA 5100
MOV C, A
LDA 5100
Loop1: CMP C
JC Loop2
INR B
SUB C
JMP Loop1
Loop2: STA 5300
MOV A, B
STA 5301
HLT

MP & MC – LAB MANUAL ECE Page | 19


TABLE: 1

Mnemonics Description
Memory Label HE
Instructio Operand X
4200 n
MVI B, 00H 06 Move immediately the data 00H to B
4201 00 register
4202 LDA 5100 3A Load 8 bit data from memory to
4203 00 accumulator
4204 51
Move accumulator content to C
4205 MOV C,A 4F
register
4206 LDA 5100 3A Load another 8 bit data in HL pair
4207 01 from memory.
4208 51
Compare accumulator content with C
4209 Loop2: CMP C B9
register content
420A JC Loop2 DA When carry set jump to specified
420B 12 memory
420C 42
420D INR BC 04 Increment B register content once
Subtract C register content from
420E SUB Loop1 91
accumulator
420F JMP C3 Jump to specified memory
4210 09
5300
4211 42
4212 Loop1: STA 32 Store accumulator data in specified
4213 00 Memory
4214 A, B 53

Move data from ‘B’ register to


4215 MOV 5301 78
accumulator
4216 STA 32 Store accumulator data in specified

MP & MC – LAB MANUAL ECE Page | 20


4217 01 memory
4218 53
4219 HLT 76 Halt

OUTPUT:

INPUT DATA: OUTPUT DATA:


5100: 20 5300: 00
5101: 60 5301: 03

MULTIPLICATION

Program:

MVIA, 00 H

MVIB, 05 H

MVID, 04 H

MVIC, 00 H

*ADD B

JNC #

INR C

# DCR D

JNZ *

STA 9000 H

MOV A, C

STA 9001 H

HLT

MP & MC – LAB MANUAL ECE Page | 21


Address Op-Code Label Mnemonics Comments

8000 3E, 00 START MVIA, 00H Move data 00H to Acc

8002 06, 05 MVIB, 05H Move data 05H to Reg. B

8004 16, 04 MVID, 04H Move data 04H to Reg. D

8006 0E, 00 MVIC, 00H Move data 00H to Reg. C

8008 80 *ADD B Add Reg. B with Acc

8009 D2, 0D, 80 JNC # Jump no carry to #

800C 0C INR C Increment Reg. C by 01H

800D 15 #DCR D Decrement Reg. D by 01H

800E C2, 08, 80 JNZ * Jump no Zero to *

8011 32, 00, 90 STA 9000H Store Acc value in 9000H

8014 79 MOV A, C Mov. Reg. C content to Acc

8015 32, 01, 90 STA 9001H Store Acc value in 9001H

8018 76 HLT Stop the process

RESULT:

Thus an assembly language program to divide and multiply two 8 bit data’s
was written and executed using 8085 microprocessor kit.

MP & MC – LAB MANUAL ECE Page | 22


MP & MC – LAB MANUAL ECE Page | 23
EX.NO 03 16-BIT ADDITION AND SUBTRACTION
USING 8085

AIM:

To write an assembly language program to add and


subtract two 16-bit
numbers using 8085 microprocessor kit.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit


• Power Chord

MP & MC – LAB MANUAL ECE Page | 24


I

:
MP & MC – Step1:
LAB MANUAL
Start the program. ECE Page | 25
Step2: Load 16 bit data in HL pair and
move data 00H to ‘C’ register. Step3:
Exchange data from HL pair to DE pair.
Step4: Load another 16 bit data in HL pair.
Step5: Add HL pair and DE pair contents and store the result
in HL pair.
Step6: If carry present Increment the content of CX
register once else leave it as it is. Step7: Store data in HL
pair to specified memory.
Step8: Move data from ‘C’
register to accumulator.
Step9: Store the accumulator
data in specified memory.
Step10: End.

MP & MC – LAB MANUAL ECE Page | 26


MNEMONICS:
MVI C, 00H
LHLD 5300
XCHG
LHLD 5302
DAD D
JNC Loop1
INR C
Loop1: SHLD 5500
MOV A, C
STA 5502
HLT

TABLE: 1

Mnemonics Description
Memory Label HE
Instruc Operand X
4100 tion
MVI C, 00H 0E Move 00H to C register
4101 00
4102 LHLD 5300 2A Load 16 bit data to HL pair
4103 00
4014 53
4105 XCHG EB Exchange HL pair data with DE pair
4106 LHLD 5302 2A Load another 16 bit data in HL pair
4107 02
4108 53
Add HL pair and DE pair contents
4109 DAD D 19
and store the result in HL pair
410A JNC Loop1 D2 If no carry move to specified address
410B 0E
410C 41

MP & MC – LAB MANUAL ECE Page | 27


410D INR C 0C Increment C register content once
410E Loop1: SHLD 5500 22 Store data in HL pair to specified
410F 00 memory
4110 55
4111 MOV A, C 79 Move ‘C’ register data to accumulator
4112 STA 5502 32 Store the accumulator data in
4113 02 specified memory
4114 55
4115 HLT 76 Halt

OUTPUT:

INPUT DATA: OUTPUT DATA:

5300: 77 5500: 10
5301: 88 5501: 9A
5302: 99 5502: 00
5303: 11

MP & MC – LAB MANUAL ECE Page | 10


16-BIT SUBTRACTION:

ALGORITHM:
Step1: Start the program.
Step2: Move immediately the data 00H to C register and accumulator.
Step3: Load 16 bit data in HL pair and exchange data from HL pair to DE pair.
Step4: Load another 16 bit data in HL pair.
Step5: Move data from ‘L’ register to accumulator.
Step6: Subtract ‘E’ register content from accumulator.
Step7: Move data from accumulator to ‘L’ register.
Step8: Move data from ‘H’ register to accumulator.
Step9: Subtract with borrow content of D register from accumulator.
Step10: Jump to Step 11 when no carry increment the content of C register once.
Step11: Move data from accumulator to ‘H’ register.
Step12: Store data in HL pair to specified memory.
Step13: Move data from ‘C’ register to accumulator.
Step14: Store the accumulator data in specified memory.
Step15: End.

MNEMONICS:
MVI C, 00H
MVI A, 00H
LHLD 5600
XCHG
LHLD 5602
MOV A, L
SUB E
MOV L, A
MOV A, H
SBB D
JNC Loop1

MP & MC – LAB MANUAL ECE Page | 11


INR C
MOV H, A
Loop1: SHLD 5700
MOV A, C
STA 5702
HLT

TABLE: 2

Mnemonics Description
Memory Label HE
Instruc Operand X
41FE tion
MVI C, 00H 0E Move 00H to C register
41FF 00
4200 MVI A, 00H 3E Move 00H to Accumulator
4201 00
4202 LHLD 5600 2A Load 16 bit data to HL pair
4203 00
4204 56
4205 XCHG EB Exchange HL pair data with DE pair
4206 LHLD 5602 2A Load another 16 bit data in HL pair
4207 02
4208 56
4209 MOV A, L 7D Move ‘L’ register data to accumulator
Subtract ‘E’ register content from
420A SUB E 93
accumulator
420B MOV L, A 6F Move accumulator data to ‘L’ register
420C MOV A, H 7C Move ‘H’ register data to Acc.
Subtract with borrow content of D
420D SBB D 9A
register from accumulator
420E JNC Loop1 D2 If no carry move to specified address
420F 12

MP & MC – LAB MANUAL ECE Page | 12


4210 42
4211 INR C 0C Increment C register content once
4212 Loop1: MOV H, A 67 Move Acc. data to ‘H’ register
4213 SHLD 5700 22 Store data in HL pair to specified
4214 00 memory
4215 57
4216 MOV A,C 79 Move ‘C’ register data to accumulator
4217 STA 5502 32 Store the accumulator data in
4218 02 specified memory
4219 57
421A HLT 76 Halt

SAMPLE INPUT/OUTPUT:

INPUT DATA: OUTPUT DATA:

5600: 11 5700: 66
5601: 21 5701: 78
5602: 77
5603: 99

RESULT:
Thus an assembly language program to add and subtract two 16-bit numbers
was written and executed using 8085 microprocessor kit.

MP & MC – LAB MANUAL ECE Page | 13


Ex. No: 04 SMALLEST AND LARGEST AMONG N NUMBERS

AI
M:
To find the smallest and largest among N numbers using
8085
microprocessor.

APPARATUS REQUIRED:

• 8085 Microprocessor Kit


• Power Chord

SMALLEST

AMONG N

NUMBERS:

ALGORITH

M:
Step1: Start the program
Step2: Get the first number in the accumulator and move it
to B
Step3: Get the second number in the memory and
move it to the accumulator Step4: Increment the
address of memory and compare the data with
accumulator Step5: If there is carry the above process
is continued until carry is not present Step6: If carry is
present then continue to compare with increment
memory

MP & MC – LAB MANUAL ECE Page | 14


Step7: If carry is absent move that data to accumulator
and decrement the B register until it become zero
Step8: Store the smallest number in the accumulator
Step9: End the program

MP & MC – LAB MANUAL ECE Page | 15


MNEMONICS:
LDA 5000
MOV B,A
LXI H,5001
MOV A,M
XX: INX H
CMP M JC
XX MOV
A,M
XY: DCR B
JNZ XY
STA 6000
HLT

TABLE 1:

Mnemonics HEX Description


Memory Label
Instruction Operand CODE
4500 LDA 5000 3A Move the first data to
accumulator
4501 00
4502 50
4503 MOV B,A 47 Move the data from A to B
4504 LXI H,5001 21 Move the second data to memory
4505 01
4506 50
4507 MOV A,M 7E Move data from M toA
4508 XX INX H 23 Increment the memory
4509 CMP M BE Compare M with A
450A JC XX DA Jump if carry
450B 0E
450C 45
450D MOV A,M 7E Move the data from M to A
450E XY DCR B 05 Decrement B register
450F JNZ XY C2 Jump if no zero
4510 08
4511 45
4512 STA 6000 32 Store the data in accumulator
4513 00
4514 60
4515 HLT 76 End of program

OUTPUT:
INPUT DATA: OUTPUT DATA:
5000: 15 6000:03
5001:03
5002:95
5003:28
LARGEST AMONG N NUMBERS:

ALGORITHM:
Step1: Start the program
Step2: Get the first number in the accumulator and move it to B
Step3: Get the second number in the memory H and move it to the accumulator
Step4: Increment the address of memory and compare the data with accumulator
Step5: If there is no carry the above process is continued until carry is present
Step6: If carry is present move that data to accumulator and decrement the B register
until
It becomes zero
Step7: Store the largest number in the accumulator
Step8: End the program

MNEMONICS:
LDA 5000
MOV B,A
LXI H,5001
MOV A,M
XX: INX H
CMP M
JNC XX
MOV A,M
XY: DCR B
JNZ XY
STA 6000
HLT
TABLE 2:

Mnemonics HEX Description


Memory Label
Instruction Operand CODE
4500 LDA 5000 3A Move the first data to
accumulator
4501 00
4502 50
4503 MOV B,A 47 Move the data from A to B
4504 LXI H,5001 21 Move the second data to memory
4505 01
4506 50
4507 MOV A,M 7E Move data from M toA
4508 XX INX H 23 Increment the memory
4509 CMP M BE Compare M with A
450A JNC XX DA Jump no carry
450B 0E
450C 45
450D MOV A,M 7E Move the data from M to A
450E XY DCR B 05 Decrement B register
450F JNZ XY C2 Jump if no zero
4510 08
4511 45
4512 STA 6000 32 Store the data in accumulator
4513 00
4514 60
4515 HLT 76 End of program
OUTPUT:

INPUT DATA: OUTPUT DATA:


5000: 15 6000:95
5001:03
5002:95
5003:28

RESULT:
Thus the smallest and largest among n numbers was found using 8085
microprocessor and their output was verified
Ex. No: 05 ASCENDING AND DECENDING ORDER OF N
NUMBERS

AIM:
To determine the ascending and descending order of the given number using
8085 microprocessor.

APPARATUS REQUIRED:
• 8085 Microprocessor Kit
• Power Chord

ASCENDING ORDER:

ALGORITHM:
Step1: Start the program
Step2: Get the first number and store it in B register and get the second number in
memory and move it to accumulator.
Step3: Increment memory and compare it with accumulator if carry is present
increment memory by decrementing B register if it is not zero.
Step4: If B register become zero decrement D register which contain number
first , zero is not obtained then get in the memory.
Step5: If it is zero store the result in the accumulator.
Step6: If the compared output contains no carry , move the value in memory to C
register and accumulator to memory and increment the value in memory.
Step7: stop the program.

MP & MC – LAB MANUAL ECE Page | 28


MNEMONICS:
LDA 5000
MOV B,A
MOV D,A
MOV E,A
LXI H,5001
MOV A,M
MOV B,E
LOOP2 INX H
CMP M
JC LOOP1
MOV C,M
MOV M,A
DCX H
MOV M,C
INX H
LOOP1 MOV A,M
DCR B;
JNZ LOOP2
DCR B
JNZ LOOP3
HLT

MP & MC – LAB MANUAL ECE Page | 29


TABLE: 1

Mnemonics HEX Description


Memory Label
Instruction Operand CODE
4500 LDA 5000 3A Get the first data to accumulator
4501 00
4502 50
4503 MOV B,A 47 Move the data from A to B
4504 MOV D,A 5F Move the data from A to D
4505 MOV E,A 57 Move the data from A to E
4506 LOOP 3 LXI H,5001 21 Move second data to memory
4507 01
4508 50
4509 MOV A,M 7E Move M to Accumulator
450A MOV B,E 43 Move E to B register
450B LOOP 2 INX H 25 Increment H Register
450C CMP M BE Compare A and M
450D JC LOOP1 DA Jump if carry to loop1
450E 15
450F 45
4510 MOV C,M 4E Move M to C register
4511 MOV M,A `77 Move A to Memory
4512 DCX H 2B Decrement H Register
4513 MOV M,C 71 Move the value from C to H
4514 INX H 23 Increment H Register
4515 LOOP 1 MOV A,M 7E Move the value from M to A
4516 DCR B O5 Decrement B Register
4517 JNZ LOOP 2 C2 Jump is no zero to LOOP 2
4518 0B
4519 45
451A DCR D 15 Decrement D Register

MP & MC – LAB MANUAL ECE Page | 30


451B JNZ LOOP 3 C2 Jump is no zero to LOOP 3
451C 06
451D 45
451E HLT 76 End of Program

OUTPUT:

INPUT DATA: OUTPUT DATA:


5000: 03 6000: 02
5001:05 6001: 03
5002:02 6002: 05
5003:06 6003: 06

MP & MC – LAB MANUAL ECE Page | 31


DESCENDING ORDER:

ALGORITHM:
Step1: Start the program
Step2: Get the first number and store it in B register and get the second number in
memory and move it to accumulator.
Step3: Increment memory and compare it with accumulator if carry is present
increment memory by decrementing B register if it is not zero.
Step4: If B register become zero decrement D register which contain number
first , zero is not obtained then get in the memory.
Step5: If it is zero store the result in the accumulator.
Step6: If the compared output contains no carry , move the value in memory to C
register and accumulator to memory and increment the value in memory.
Step7: stop the program.

MNEMONICS:
LDA 5000
MOV B,A
MOV D,A
MOV E,A
LXI H,5001
MOV A,M
MOV B,E
LOOP2 INX H
CMP M
JNC LOOP1
MOV C,M
MOV M,A
DCX H
MOV M,C
INX H

MP & MC – LAB MANUAL ECE Page | 32


LOOP1 MOV A,M
DCR B;
JNZ LOOP2
DCR B
JNZ LOOP3
HLT

TABLE: 2

Mnemonics HEX Description


Memory Label
Instruction Operand CODE
4500 LDA 5000 3A Get the first data to accumulator
4501 00
4502 50
4503 MOV B,A 47 Move the data from A to B
4504 MOV D,A 5F Move the data from A to D
4505 MOV E,A 57 Move the data from A to E
4506 LOOP 3 LXI H,5001 21 Move second data to memory
4507 01
4508 50
4509 MOV A,M 7E Move M to Accumulator
450A MOV B,E 43 Move E to B register
450B LOOP 2 INX H 25 Increment H Register
450C CMP M BE Compare A and M
450D JNC LOOP1 DA Jump if carry to loop1
450E 15
450F 45
4510 MOV C,M 4E Move M to C register
4511 MOV M,A `77 Move A to Memory
4512 DCX H 2B Decrement H Register
4513 MOV M,C 71 Move the value from C to H

MP & MC – LAB MANUAL ECE Page | 33


4514 INX H 23 Increment H Register
4515 LOOP1 MOV A,M 7E Move the value from M to A
4516 DCR B O5 Decrement B Register
4517 JNZ LOOP 2 C2 Jump is no zero to LOOP 2
4518 0B
4519 45
451A DCR D 15 Decrement D Register
451B JNZ LOOP 3 C2 Jump is no zero to LOOP 3
451C 06
451D 45
451E HLT 76 End of Program

OUTPUT:

INPUT DATA: OUTPUT DATA:


5000: 03 6000: 06
5001:05 6001: 05
5002:02 6002: 03
5003:06 6003: 02

RESULT:
Thus the Ascending and Descending order of given N- numbers was
performed and their output was verified.

MP & MC – LAB MANUAL ECE Page | 34


Ex. No: 06 CODE CONVERSIONS

AI
M:
To write an assembly language program to convert
hexadecimal to decimal
and hexadecimal to binary data’s using 8085-microprocessor
kit.

APPARATUS REQUIRED:
• 8085 Microprocessor Kit

Power Chord

HEXADECIMAL TO

DECIMAL

CONVERSION:

ALGORITHM:
Step1: Start the program.
Step2: Load data from memory to accumulator and move
the data 00 to D and E
r
e
g
i
s
t
e
r
s
.
Step3: Compare the
accumulator data with the

MP & MC – LAB MANUAL ECE Page | 35


data 64. Step4: If carry=0
jump to Step 6 else jump to
Step 5. Step5: Jump to Step
10.
Step6: Subtract accumulator data by 64.
Step7: Increment the
content of D register once.
Step8: If carry=0 jump to
Step 6 else jump to Step 9.
Step9: Decrement the content of D register once and add
data 64 with accumulator. Step10: Subtract accumulator
data by 0A and Increment E register content once. Step11:
If carry=0 jump to Step 10 and Decrement E register
content once.
Step12: Add data 64 with accumulator
and move it to C register. Step13:
Move E register content to
accumulator.
Step14: Rotate the accumulator
content 4 tines by left. Step15:
Add C register content with
accumulator content. Step16:
Store data in accumulator pair to
specified memory Step17: Move
D register content to accumulator

MP & MC – LAB MANUAL ECE Page | 36


Step18: Store data in accumulator pair to specified memory.
Step19: End.

MNEMONICS:
MVI E, 00
MVI D, 00
LDA 4200
CPI 64
JNC Loop1
JMP Loop2
Loop1: SUI 64
INR D
JNC Loop1
DCR D
ADI 64
Loop2: SUI 0A
INR E
JNC Loop2
DCR E
ADI 0A
MOV C, A
MOV A, E
RLC
RLC
RLC
RLC
ADD C
STA 4500
MOV A, D
STA 4501
HLT

MP & MC – LAB MANUAL ECE Page | 36


TABLE: 1

Mnemonics Description
Memory Label HE
Instruc Operand X
4100 tion
MVI E, 00H 1E Move data 00 to E register
4101 00
4102 MVI D, 00H 16 Move data 00 to D register
4103 00
4014 LDA 4200 3A Load data from memory
4105 00 to accumulator
4106 42
4107 CPI 64 FE Compare the accumulator data
4108 64 with the data 64
4109 410F D2 If carry=0 jump to specified memory
JNC
410A 0F
410B 41
4118 Jump to specified memory
410C JMP C3
410D 18
410E Loop1 41
64 Subtract accumulator data by 64
410F SUI D6
4110 64
D Increment D register content once
4111 INR 14
410F If carry=0 jump to specified memory
4112 JNC D2
4113 0F
4114 41
D Decrement D register content once
4115 DCR 15
64 Add data 64 with accumulator
4116 ADI C6
4117 Loop2 64
0A Subtract accumulator data by
4118 SUI D6
4119 E 0A
0A Increment E register
INR
411A 4118 1C
JNC
411B D2 content once

MP & MC – LAB MANUAL ECE Page | 37


411D 41
411E DCR E 1D Decrement E register content once
411F ADI 0A C6 Add data 64 with accumulator
4120 0A
4121 MOV C, A 4F Move accumulator content to C
register
4122 MOV A, E 7B
Move E register content to
4123 RLC 07 accumulator
4124 RLC 07
4125 RLC 07 Rotate the accumulator content 4
4126 RLC 07 tines by left

4127 C 81
ADD
Add C register content with
4128 4500 32
STA accumulator content
4129 00
Store data in accumulator pair
412A 45
A, D to specified memory
412B MOV 7A
4501
412C STA 32
Move D register content to
412D 01
accumulator Store data in
412E 45
accumulator pair to specified

OUTPUT:

INPUT DATA: OUTPUT DATA:


4200: CE 4500: 06
4501: 02

MP & MC – LAB MANUAL ECE Page | 38


HEXADECIMAL TO BINARY CONVERSION:

ALGORITHM:
Step1: Start the program.
Step2: Load data from memory to accumulator
Step3: Divide accumulator content by 2 and store the quotient in accumulator and
reminder in next consecutive memory location.
Step4: Repeat Step 3 until quotient becomes 1.
Step5: If quotient becomes 1 store it in next memory location.
Step6: End.

MNEMONICS:
LXI H, 4300
MOV A, M
MVI C, 02
Loop4: MVI D, 00
Loop1: SUB C
INR D
JC Loop2
JMP Loop1
Loop2: ADD C
INX H
MOV M, A
DCR D
MOV A, D
CPI 01
JZ Loop3
JMP Loop4
Loop3: INX H
MOV M, D
HLT

MP & MC – LAB MANUAL ECE Page | 39


TABLE: 2

Mnemonics Description
Memory Label HE
Instruc Operand X
4100 tion
LXI H,4300 21 Load memory to HL register pair
4101 00
4102 43
Move data from memory to
4103 MOV A,M 72
accumulator
4014 MVI C,02 0E Move data 02 to C register
4105 02
4106 Loop4: MVI D, 00 16 Initialize D register
4107 00
4108 Loop1: SUB CD 91 Subtract C register content from A
4109 INR Loop2 14 Increment D register content once
410A JC DA Jump when carry=1 to specified
410B 10 Memory
410C Loop1 44
410D JMP C3 Jump to specified Memory
410E 08
410F C 41
4110 Loop2: ADD H 81 Add C register content with A
4111 INX 23 Increment HL pair content once
M, A
Move data from accumulator to
4112 MOV 77
D memory
4113 DCR A, D 15 Decrement D register content once
4114 MOV 01 7A Move D register content to A
4115 CPI FE Compare D register content with 01
4116 Loop3 01
4117 JZ C4 Jump when ZF=1 to specified
4118 1C Memory

MP & MC – LAB MANUAL ECE Page | 40


4119 41
411A JMP Loop4 C3 Jump to specified Memory
411B 06
411C 44
411D Loop3: INX H 23 Increment HL pair memory once
411E MOV M, D 72 Move D register data to Memory
411F HLT 76 Halt

OUTPUT:

INPUT DATA: OUTPUT DATA:


4300: DE 4301: 00 4305: 01
4302: 01 4306: 00
4303: 01 4307: 01
4304: 01 4308: 01

RESULT:

Thus an assembly language program to convert hexadecimal to decimal and


hexadecimal to binary data’s was written and executed using 8085-microprocessor
kit.

MP & MC – LAB MANUAL ECE Page | 41


Ex. No:07
32 BIT ADDITION & SUBTRACTON USING 8086

AI
M:
To write an assembly language program to add and
subtract two 32-bit
numbers using 8086 microprocessor kit.

APPARATUS REQUIRED:
• 8086 Microprocessor Kit
• Power Chord
• Key Board

MP & MC – LAB MANUAL ECE Page | 62


A

I
MP & MC – LAB MANUAL ECE Page | 63
T

:
Step1: Start the program.
Step2: Move immediately the
number 0000H to CX register.
Step3: Copy the contents of the
memory 3000 to AX register.
Step4: Add the content of the memory 3004 with
the content of AX register. Step5: Copy the
content to AX register to two memories from
2000.
Step6: Copy the contents of the memory 3002 to AX
register.
Step7: Add the content of the memory 3006 with
the content of AX register. Step8: Jump to
specified memory location if there is no carry i.e.
CF=0. Step9: Increment the content of CX register
once.
Step10: Copy the content to AX register to
two memories from 2002. Step11: Copy the
content to CX register to two memories
from 2004. Step12: End.

MP & MC – LAB MANUAL ECE Page | 64


MNEMONICS:
MOV CX, 0000
MOV AX, [3000]
ADD AX, [3004]
MOV [2000], AX
MOV AX, [3002]
ADC AX, [3006]
JNC loop1
INC CX
Loop1 MOV [2002], AX
MOV [2004], CX
HLT

TABLE: 1

Mnemonics
Memory Label Description
Instruction Operand
1000 MOV CX,0000 Move immediately 0000H to CX register
1004 MOV AX, [3000] Copy contents of 3000 to AX register
Add content of memory 3004 with
1008 ADD AX, [3004]
content of AX register
Copy content to AX register to two
100C MOV [2000], AX
memories from 2000
Copy contents of memory 3002 to
1010 MOV AX, [3002]
AX register
Add content of memory 3006 with
1014 ADC AX, [3006]
content of AX register
1018 JNC loop1 Jump to specified memory CF=0
Increment content of CX register
101A INC CX
once
Copy content to AX register to two
101B Loop1 MOV [2002], AX
memories from 2002
Copy content to CX register to two
101F MOV [2004], CX
memories from 2004
1023 HLT Halt

OUTPUT:

INPUT DATA: OUTPUT DATA:


3000: 9999 2000: 3332
3002: 9999 2002: 3333
3004: 9999 2004: 1
3006: 9999
32 - BIT SUBTRACTION:

ALGORITHM:
Step1: Start the program.
Step2: Move immediately the number 0000H to CX register.
Step3: Copy the contents of the memory 3000 to AX register.
Step4: Add the content of the memory 3004 with the content of AX register.
Step5: Copy the content to AX register to two memories from 2000.
Step6: Copy the contents of the memory 3002 to AX register. Step7:
Subtract the content of the memory 3006 from AX register. Step8:
Jump to specified memory location if there is no carry i.e. CF=0. Step9:
Increment the content of CX register once.
Step10: Copy the content to AX register to two memories from 2002.
Step11: Copy the content to CX register to two memories from 2004.
Step12: End.

MNEMONICS:

MOV CX, 0000


MOV AX, [3000]
ADD AX, [3004]
MOV [2000], AX
MOV AX, [3002]
SBB AX, [3006]
JNC loop1
INC CX
Loop1 MOV [2002], AX
MOV [2004], CX
HLT
TABLE: 2
Mnemonics
Memory Label Description
Instruction Operand
1000 MOV CX,0000 Move immediately 0000H to CX register
1004 MOV AX, [3000] Copy contents of 3000 to AX register
Add content of memory 3004 with
1008 ADD AX, [3004]
content of AX register
Copy content to AX register to two
100C MOV [2000], AX
memories from 2000
Copy contents of memory 3002 to
1010 MOV AX, [3002]
AX register
Subtract content of memory 3006
1014 SBB AX, [3006]
from content of AX register
1018 JNC loop1 Jump to specified memory CF=0
Increment content of CX register
101A INC CX
once
Copy content to AX register to two
101B Loop1 MOV [2002], AX
memories from 2002
Copy content to CX register to two
101F MOV [2004], CX
memories from 2004
1023 HLT Halt

OUTPUT:
INPUT DATA: OUTPUT DATA:
3000: 9999 2000: 0000
3002: 9799 2002: FE00
3004: 9999
3006: 9999

RESULT:
Thus an assembly language program to add and subtract two 32-bit numbers
was written and executed using 8086 microprocessor kit.
MP & MC – LAB MANUAL ECE Page | 68
MP & MC – LAB MANUAL ECE Page | 69
Ex. No: 08 16 BIT MULTIPLICATION AND DIVISION USING 8086

AI
M:
To write an assembly language program to multiply and
divide two unsigned
16-bit numbers using 8086 microprocessor kit.

APPARATUS REQUIRED:
• 8086 Microprocessor Kit
• Power Chord
• Key Board

MP & MC – LAB MANUAL ECE Page | 70


T

:
MP & MC – LAB MANUAL ECE Page | 71
Step 1: Start the program.
Step2: Copy the contents of the
memory 3000 to AX register. Step3:
Copy the contents of the memory
3002 to CX register.
Step4: Multiply the content of the CX register with
the content of accumulator. Step5: Copy the content
to AX register to the memory 2000.
Step6: Copy the contents of DX
register to the memory 2002. Step7:
End.

MNEMONICS:
M
O
V

A
X
,

[
3
0
0
0
]

M
O
V

MP & MC – LAB MANUAL ECE Page | 72


C
X
,

[
3
0
0
2
]

M
U
L

C
X
M
O
V

[
2
0
0
0
]
,

A
X

MP & MC – LAB MANUAL ECE Page | 73


M
O
V

[
2
0
0
2
]
,

D
X

H
L
T

MP & MC – LAB MANUAL ECE Page | 74


TABLE: 1
Mnemonics
Memory Label Description
Instructio Operand
n
1000 MOV AX, [3000] Copy contents of 3000 to AX register
1004 MOV CX, [3002] Copy contents of 3002 to CX register
Multiply the content of the CX
1008 MUL CX
register with the content of
accumulator
100A MOV [2000], AX
Copy content to AX register to the
memory 2000
100E MOV [2004], DX
Copy content to DX register to the
1012 HLT memory 2002

OUTPUT:

INPUT DATA: OUTPUT DATA:


3000: 1234 2000: 0060
3002: 5678 2002: 0626
DIVISION:

ALGORITHM:
Step 1: Start the program.
Step2: Copy the contents of the memory 3000 to AX register.
Step3: Copy the contents of the memory 3002 to CX register.
Step4: Divide the content of the CX register from the content of accumulator.
Step5: Copy the content to AX register to the memory 2000.
Step6: Copy the contents of DX register to the memory 2002.
Step7: End.

MNEMONICS:
MOV AX, [3000]
MOV CX, [3002]
DIV CX
MOV [2000], AX
MOV [2002], DX
HLT

TABLE: 2

Mnemonics
Memory Label Description
Instructio Operand
n
1000 MOV AX, [3000] Copy contents of 3000 to AX register
1004 MOV CX, [3002] Copy contents of 3002 to CX register
Divide the content of the CX
1008 DIV CX
register with the content of
accumulator
100A MOV [2000], AX
Copy content to AX register to the
memory 2000
100E MOV [2004], DX
Copy content to DX register to the
1012 HLT memory 2002
OUTPUT:

INPUT DATA: OUTPUT DATA:


3000: 1234 2000: 0000
3002: 5678 2002: 4444

RESULT:

Thus an assembly language program to multiply and divide two unsigned


16-bit numbers was written and executed using 8086 microprocessor kit.

MP & MC – LAB MANUAL ECE Page | 70


Ex. No:09 16 BIT ADDITION

AI
M:
To write an assembly language program to add the two
16 bit data’s using
8051 Micro controller.

APPARATUS REQUIRED:

• 8051 Microcontroller kit.



Power chord.

ALGORITHM:

Step1: Start the program.


Step2: Load the lower byte of the two data’s into
accumulator and R0 register. Step3: Add the two
data’s.
Step4: Move the added data into R6 register and
initialize the R2 register. Step5: Load the higher byte
of the two data’s into accumulator and R1 register.
Step6: Add the two data’s with carry.
Step7: If carry comes, increment R2 register content once.
Step8: Store the accumulator data and R6 and R2
register data’s into the memory. Step9: Stop the
program.
MP & MC – LAB MANUAL ECEPage | 86
MNEMONICS:
MOV DPTR,#4400
MOVX A,@DPTR
MOV R0,A
MOV R2,#00
INC DPTR
MOVX A,@DPTR
MOV R1,A
INC DPTR
MOVX A,@DPTR
ADD A,R0
MOV R6,A
INC DPTR
MOVX A,@DPTR
ADDC A,R1
JNC LOOP1
INC R2
LOOP1: INC DPTR
MOVX @DPTR,A
INC DPTR
MOV A,R6
MOVX @DPTR,A
INC DPTR
MOV A,R2
MOVX @DPTR,A
LOOP2: SJMP LOOP2

MP & MC – LAB MANUAL ECE Page | 87


TABLE:

Label MNEMONICS Hex Description


Memory
code
4100 MOV DPTR,#4400 90 Move data 4400 to DPTR
4101 44
4102 00
4103 MOVX A,@DPTR E0 Move data from DPTR to Accumulator.
4104 MOV R0,A F8 Move data from Accumulator to R0
register.
4105 MOV R2,#00 7A Clear the R2 register.
4106 00
4107 INC DPTR A3 Increment DPTR content once.
4108 MOVX A,@DPTR E0 Load the data from DPTR to
Accumulator.
4109 MOV R1,A F9 Move the data to R1 register from
Accumulator.
410A INC DPTR A3 Increment DPTR content once.
410B MOVX A,@DPTR E0 Load the data from DPTR to
Accumulator.
410C ADD A,R0 28 Add Accumulator data and R0 register
data.
410D MOV R6,A FE Move data from Accumulator to R6
register.
410E INC DPTR A3 Increment DPTR content once.
410F MOVX A,@DPTR E0 Load the data from DPTR to
Accumulator.
4110 ADDC A,R1 39 Add Accumulator data and R0 register
data with carry.
4111 JNC LOOP1 50 Jump when carry=0 to loop1.

MP & MC – LAB MANUAL ECE Page | 88


4112 01
4113 INC R2 0A Increment the content of R2 register
once.
4114 Loop1 INC DPTR A3 Increment DPTR content once.
4115 MOVX @DPTR,A F0 Store the Accumulator data to DPTR.
4116 INC DPTR A3 Increment DPTR content once.
4117 MOV A,R6 EE Move the data from R6 register to
Accumulator.
4118 MOVX @DPTR,A F0 Store the Accumulator data to DPTR.
4119 INC DPTR A3 Increment DPTR content once.
411A MOV A,R2 EA Move the data from R2 register to
Accumulator.
411B MOVX @DPTR,A F0 Store the Accumulator data to DPTR.
411C Loop2 SJMP LOOP2 80 Jump to loop2.
411D 41
411E 1C

OUTPUT:

INPUT DATA: OUTPUT DATA:


4400: 23 4404: A6
4401: 32 4405: 6A
4402: 47 4406: 00
4403: 74

RESULT:

Thus an assembly language program to add two 16-bit data’s was written and
executed using 8051 micro controller kit.

MP & MC – LAB MANUAL ECE Page | 89


Ex. No:10 16 BIT SUBTRACTION

AI
M:
To write an assembly language program to subtract the
two 16 bit data’s using
8051 Micro controller.

APPARATUS REQUIRED:

• 8051 Microcontroller kit.



Power chord.

ALGORITHM:

Step1: Start the program.


Step2: Load the lower byte of the two data’s into
accumulator and R0 register. Step3: Subtract the
two data’s.
Step4: Move the subtracted data into R6 register and
initialize the R2 register. Step5: Load the higher byte
of the two data’s into accumulator and R1 register.
Step 6: Subtract the two data’s with borrow.
Step7: If carry comes, increments R2 register content once.
Step8: Store the accumulator data and R6 and R2
register data’s into the memory. Step9: Stop the
program.

MP & MC – LAB MANUAL ECE Page | 90


MNEMONICS:

MOV DPTR,#4400
MOVX A,@DPTR
MOV R0,A
MOV R2,#00
INC DPTR
MOVX A,@DPTR
MOV R1,A
INC DPTR
MOVX A,@DPTR
SUBB A,R0
MOV R6,A
INC DPTR
MOVX A,@DPTR
SUBB A,R1
JNC LOOP1
INC R2
LOOP1: INC DPTR
MOVX @DPTR,A
INC DPTR
MOV A,R6
MOVX @DPTR,A
INC DPTR
MOV A,R2
MOVX @DPTR,A
LOOP2: SJMP LOOP2

MP & MC – LAB MANUAL ECE Page | 91


TABLE:

Label Mnemonics Hex Description


Memory
code
4100 MOV DPTR,#4400 90 Move data 4400 to DPTR
4101 44
4102 00
4103 MOVX A,@DPTR E0 Move data from DPTR to Accumulator.
4104 MOV R0,A F8 Move data from Accumulator to R0
register.
4105 MOV R2,#00 7A Clear the R2 register.
4106 00
4107 INC DPTR A3 Increment DPTR content once.
4108 MOVX A,@DPTR E0 Load the data from DPTR to
Accumulator.
4109 MOV R1,A F9 Move the data to R1 register from
Accumulator.
410A INC DPTR A3 Increment DPTR content once.
410B MOVX A,@DPTR E0 Load the data from DPTR to
Accumulator.
410C SUBB A,R0 98 Subtract Accumulator data and R0
register data.
410D MOV R6,A FE Move data from Accumulator to R6
register.
410E INC DPTR A3 Increment DPTR content once.
410F MOVX A,@DPTR E0 Load the data from DPTR to
Accumulator.
4110 SUBB A,R1 99 Subtract Accumulator data and R0
register data with carry.
4111 JNC LOOP1 50 Jump when carry=0 to loop1.

MP & MC – LAB MANUAL ECE Page | 92


4112 01
4113 INC R2 0A Increment the content of R2 register
once.
4114 Loop1 INC DPTR A3 Increment DPTR content once.
4115 MOVX @DPTR,A F0 Store the Accumulator data to DPTR.
4116 INC DPTR A3 Increment DPTR content once.
4117 MOV A,R6 EE Move the data from R6 register to
Accumulator.
4118 MOVX @DPTR,A F0 Store the Accumulator data to DPTR.
4119 INC DPTR A3 Increment DPTR content once.
411A MOV A,R2 EA Move the data from R2 register to
Accumulator.
411B MOVX @DPTR,A F0 Store the Accumulator data to DPTR.
411C Loop2 SJMP LOOP2 80 Jump to loop2.
411D 41
411E 1C

OUTPUT:

INPUT DATA: OUTPUT DATA:


4500: BC 4504: 80
4501: 19 4505: 34
4502: 88 4506: 01
4503: 99

RESULT:
Thus an assembly language program to subtract two 16-bit data’s was written
and executed using 8051 micro controller kit.

MP & MC – LAB MANUAL ECE Page | 93


Ex. No: 11 16 BIT MULTIPLICATION

AI
M:
To write an assembly language program to multiply two
16 bit data’s using
8051 Micro controller.

APPARATUS REQUIRED:

• 8051 Microcontroller kit.


• Power chord.

ALGORITHM:
Step1: Start the program.
Step2: Load the two data’s into
Accumulator and B register.
Step3: Multiply the two data’s.
Step4: Store
the result into
the memory.
Step5: Stop
the program.

MNEMONICS:
MOV DPTR,#4400
MOVX A,@DPTR
MOV 0F0,A
INC DPTR
MOVX A,@DPTR
MUL AB

MP & MC – LAB MANUAL ECE Page | 94


INC DPTR
MOVX @DPTR,A
INC DPTR
MOV A,0F0
MOVX @DPTR,A
LOOP1: SJMP LOOP1

MP & MC – LAB MANUAL ECE Page | 95


TABLE: 1

Label Mnemonics Hex Description


Memory
code
4100 MOV DPTR,#4400 90 Move data 4400 to DPTR
4101 44
4102 00
4103 MOVX A,@DPTR E0 Move data from DPTR to Accumulator.
4104 MOV 0F0,A F5 Move data from Accumulator to B register.
4105 F0
4106 INC DPTR A3 Increment DPTR content once.
4107 MOVX A,@DPTR E0 Move data from DPTR to Accumulator.
4108 MUL AB A4 Multiply the Accumulator content and B
register.
4109 INC DPTR A3 Increment DPTR content once.
410A MOVX @DPTR,A F0 Store the Accumulator content to DPTR.
410B INC DPTR A3 Increment DPTR content once.
410C MOV A,0F0 E5 Move the data from B register to
410D F0 Accumulator.
410E MOVX @DPTR,A F0 Store the Accumulator content to DPTR.
410F Loop2 SJMP LOOP1 80 Jump to loop1.
4110 41
4111 1C
OUTPUT:

INPUT DATA: OUTPUT DATA:

4400: 4404:
4401: 4405:
4402:
4403:

RESULT:

Thus an assembly language program to multiply two data’s was written and
executed using 8051 micro controller kit.
Ex. No: 12 16 BIT DIVISION

AI
M:
To write an assembly language program to divide two
16 bit data’s using 8051
Micro controller.

APPARATUS REQUIRED:

• 8051 Microcontroller kit.


• Power chord.

ALGORITHM:
Step1: Start the program.
Step2: Load the two data’s into
Accumulator and B register. Step3:
Divide the two data’s.
Step4: Store
the result into
the memory.
Step5: Stop
the program.

MNEMONICS:
MOV DPTR,#4400
MOVX A,@DPTR
MOV 0F0,A
INC DPTR
MOVX A,@DPTR
DIV AB
INC DPTR

MP & MC – LAB MANUAL ECE Page | 97


MOVX @DPTR,A
INC DPTR
MOV A,0F0
MOVX @DPTR,A
LOOP1: SJMP LOOP1

MP & MC – LAB MANUAL ECE Page | 98


TABLE: 1

Label Mnemonics Hex Description


Memory
code
4100 MOV DPTR,#4400 90 Move data 4400 to DPTR
4101 44
4102 00
4103 MOVX A,@DPTR E0 Move data from DPTR to Accumulator.
4104 MOV 0F0,A F5 Move data from Accumulator to B register.
4105 F0
4106 INC DPTR A3 Increment DPTR content once.
4107 MOVX A,@DPTR E0 Move data from DPTR to Accumulator.
4108 DIV AB 84 Divide the Accumulator content and B
register.
4109 INC DPTR A3 Increment DPTR content once.
410A MOVX @DPTR,A F0 Store the Accumulator content to DPTR.
410B INC DPTR A3 Increment DPTR content once.
410C MOV A,0F0 E5 Move the data from B register to
410D F0 Accumulator.
410E MOVX @DPTR,A F0 Store the Accumulator content to DPTR.
410F Loop2 SJMP LOOP1 80 Jump to loop1.
4110 41
4111 1C
OUTPUT:

INPUT DATA: OUTPUT DATA:

4400: 4404:
4401: 4405:
4402:
4403:

RESULT:

Thus an assembly language program to divide two data’s was written and
executed using 8051 microcontroller kit.
EX.NO.13 ADC INTERFACING WITH 8085

Aim:

To perform ADC Interfacing using 8085 microprocessor kit to generate digital


output.

Apparatus Required:

1. One 8085 microprocessor kit


2. + 5 v Power supply
3. ADC (0808/7109)
4. Buses

Program:

ORG 4100H

START: MVI A, 10

OUT 0C8 H

MVI A, 18

OUT 0C8 H

MVI A, 01

OUT ODOH

XRA A

XRA A

XRA A

MVI A, 00

OUT ODOH

LOP IN 0D8H

ANI 01

CPI 01

JNZ LOOP

IN OCOH
STA 4150H

HLT

Address Op-Code Label Mnemonics Comments

4100 3E,10 START MVI A, 10 Move immediately 10 H to A

4102 D3, C8 OUT 0C8 Out the value 0C8H

4104 3E,18 MVI A, 18H Move immediately 18H to A

4106 D3,C8 OUT C8H Out the value C8H

4108 3E,01 MVI A,01 Move immediately 01H to A

410A D3,D0 OUT 0D0H Out the value 0D0 H

410C AF XRA A Perform EX-OR

410D AF XRA A Operation with A

410E AF XRA A

410F 3E, 00 MVI A, 00 Move immediately 00

4111 D3, D0 OUT 0D0H Out 0D0H value

4113 DB, D8 LOOP IN 0D8H In the value 0D8H

4115 E6, 01 ANI 01 Perform AND operation of 01

4117 FE, 01 CPI 01 Compare 01

4119 C2, 13,41 JNZ LOOP On non-zero jump to loop

411C DB, C0 IN 0C0H In the value of C0H

411E 32,50,41 STA 4150H Store the data in 4150H

4121 76 HLT End the program


INPUT LED DISPLAY ADDRESS OUTPUT

0000 0000 4150H

1111 1111 FFH

0110 1100 6CH

1000 1110 8EH

0111 0001 71H

0101 1111 5FH

Result:

Thus ADC interfacing with 8085 microprocessor kit to generate digital output is
done

EX.NO.14 INTERFACING DAC WITH 8085


Aim: -

To connect DAC at 8255 ports and to generate the following waves

a) Square – wave (DAC2)


b) Saw – tooth wave (DAC1)
c) Triangular wave (DAC2)
d) Step wave (DAC2)
e) Stair case wave (DAC2)

PROGRAM: -

(Square wave)

ORG 4100H

START: MVI A, 00

OUT 0C8

CALL DELAY

MVI A, OFF

OUT 0C8

CALL DELAY

JMP START

DELAY: MVI B, 05

L1 MVI C, OFF

L2 DCR C

JNZ L2

DCR B

JNZ L1

RET

Address Op – code Label Mnemonics Comments

4100 3E, 00 START MVI A, 00

4102 D3, C8 OUT 0C8

4104 CD, 11, 41 CALL DELAY

4107 3E, FF MVI A, OFF


4109 D3, C8 OUT 0C8

410B CD, 11, 41 CALL DELAY

410E C3, 00, 41 JMP START

4111 06, 05 DELAY MVI B, 05

4113 0E, FF L1 MVI C, OFF

4115 0D L2 DCR C

4116 C2, 15, 41 JNZ L2

4119 05 DCR B

411A C2, 13, 41 JNZ L1

411D C9 RET

PROGRAM: -

(Saw tooth wave)

ORG 4100

START: MVI A, 00

L1: OUT 0C0H

INR A

JNZ L1

JMP START

Address Op – code Label Mnemonics Comments

4100 3E, 00 START MVI A, 00

4102 D3, C0 L1 OUT 0C0

3C INR A

C2, 02, 41 JNZ L1

C3, 00, 41 JMP START


PROGRAM: -

(Triangular wave)

ORG 4100

Start: MVI L, 00

L1: MOV A, L

OUT 0C8

INR L

JNZ L1

MVI L, OFFH

L2: MOV A, L

OUT 0C8

DCR L

JNZ L2

JMP START

Address Op – code Label Mnemonics Comments

4100 2E, 00 START MVI L, 00

4102 7D L1 MOV A, L

4103 D3, C8 OUT 0C8

4105 2C INR L

4106 C2, 02, 41 JNZ L1

4109 2E, FF MVI L, OFFH

410B 7D L2 MOV A, L

410C D3, C8 OUT 0C8

410E 2D DCR L

410F C2, 0B, 41 JNZ L2

4112 C3, 00,41 JMP START

PROGRAM: -
(Step wave)

SIMPLE I/O MODE 0

ORG 4100H

CONTROL WORD EQU 80 H

CONTROL REG EQU C8 H

START: MVI A, CONTROL REG (80H)

OUT CONTROLREG (C8 H)

LOOP: MVI A, 00

OUT C8

CALL DELAY

MVI A, 80 H

OUT C8

CALL DELAY

MVI A, FF

OUT C8

CALL DELAY

MVI A, 80 H

OUT C8

CALL DELAY

JMP LOOP

DELAY: MVI B, FF

LOOP1: DCR B

JNZ LOOP1

RET

Address Op – code Label Mnemonics Comments


4100 3E, 80 START MVI A, 80 Move CW 80 to Acc

4102 D3, C8 OUT C8 Out Acc content to port A

4104 3E, 00 LOOP MVI A, 00 Move data 00 to Acc

4106 D3, C8 OUT C8 Out Acc content to port A

4108 CD, 00, 45 CALL DELAY Call DELLAY subroutine

410B 3E, 80 MVI A, 80 H Move data 80 to Acc

410D D3, C8 OUT C8 Out Acc content to port A

410F CD, 00, 45 CALL DELAY Call DELLAY subroutine

4112 3E, FF MVI A, FF Move data FF to Acc

4114 D3, C8 OUT C8 Out Acc content to port A

4116 CD, 00, 45 CALL DELAY Call delay subroutine

4119 3E, 80 MVI A, 80 H Move data 80 to Acc

411B D3, C8 OUT C8 Out Acc content to port A

411D CD, 00, 45 CALL DELAY Call DELLAY subroutine

4120 C3, 04, 41 JMP LOOP Jump to LOOP

SUBROUTINE (STEP WAVE)

Address Op – code Label Mnemonics Comments

4500 06, FF DELAY MVIB , FF Move data FF to reg.

4502 05 LOOP1 DCR B Decrement reg. B content by 1

4503 C2, 02, 45 JNZ LOOP1 Jump no zero to loop1

4506 C9 RET Return to main program


PROGRAM: -

(Stair Case wave)

SIMPLE I/O MODE 0

ORG 4100H

CONTROL WORD EQU 80 H

CONTROL REG EQU C8 H

START: MVI A, CONTROL REG (80H)

OUT CONTROLREG (C8 H)

LOOP: MVI A, 00

OUT C8

CALL DELAY

MVI A, 80 H

OUT C8

CALL DELAY

MVI A, FF

OUT C8

CALL DELAY

JMP LOOP

DELAY: MVI B, FF

LOOP1: DCR B

JNZ LOOP1

RET

Address Op – code Label Mnemonics Comments

4100 3E, 80 START MVI A, 80 Move CW 80 to Acc


4102 D3, C8 OUT C8 Out Acc content to port A

4104 3E, 00 LOOP MVI A, 00 Move data 00 to Acc

4106 D3, C8 OUT C8 Out Acc content to port A

4108 CD, 00, 45 CALL DELAY Call DELLAY subroutine

410B 3E, 80 MVI A, 80 H Move data 80 to Acc

410D D3, C8 OUT C8 Out Acc content to port A

410F CD, 00, 45 CALL DELAY Call DELLAY subroutine

4112 3E, FF MVI A, FF Move data FF to Acc

4114 D3, C8 OUT C8 Out Acc content to port A

4116 CD, 00, 45 CALL DELAY Call delay subroutine

4119 C3, 04, 41 JMP LOOP Jump to LOOP

SUBROUTINE (STAIR CASE WAVE)

Address Op – code Label Mnemonics Comments

4500 06, FF DELAY MVIB , FF Move data FF to reg.

4502 05 LOOP1 DCR B Decrement reg. B content by 1

4503 C2, 02, 45 JNZ LOOP1 Jump no zero to loop1

4506 C9 RET Return to main program


Result:

The program to verify all wave forms for using DAC and written the program

entered and executed.


EX.NO.15 TRAFFIC LIGHT CONTROL SYSTEM
USING 8085

Aim: -

To write an assembly language program to simulate a real traffic light system.

Apparatus Required: -

1. 8085 – Microprocessor kit,


2. +5 V power Supply,
3. Probes

ALOGRITHM: -

1. Load the reg., pair immediately.


2. Move immediately the C reg., to E and then move to acc.
3. The content of acc is occupied to specified port.
4. Increment HL pair of one bit and then move.
5. The contents of acc are occupied a ‘A’ port, move memory to acc.
6. Increment HL reg., pair by one bit and then move memory to acc.
7. The contents of acc are copied to B port.
8. The program execution is transformed to specified address.
9. Decrement C reg., pair and jump to specified address.
10. Move the data in C reg., and jump to specified loop.
11. Decrement D reg., pair and move D reg., to A reg.
12. The contents of E reg., logically OR with acc.
13. Jump to specified loop and decrement C reg., pair.
14. Jump to specified loop.
15. The program sequence is transfer from subroutine to calling program.
PROGRAM: -

ORG 4100 H

CNT EQU 0F H

APRT EQU 0C H

BPRT EQU 0D H

START LXI H, DATA

MVI C, 0C

MOV A, M

OUT CNT

INX H

LOOP1: MOV A, M

OUT APRT

INX H

MOV A, M

OUT BPRT

CALL DELAY

INX H

DCR C

JNZ LOOP1

JMP START

DELAY PUSH B

MVI C, 05
LOOP3 LXI D, FFFF

LOOP2 DCX, D

MOV A, D

ORA E

JNZ LOOP2

DCR C

JNZ LOOP3

POP B

RET

Address Op – code Label Mnemonics Comments

4100 21,00,45 START LXI H, DATA Initialize data table

MVI C 0C Initialize the counter for


data table
4103 0E, 0C

4105 7E MOV A, M

4106 D3, 0F OUT CNT

4108 23 INX H

4109 7E LOOP1 MOV A, M

410A D3, 0C OUT APRT

410C 23 INX H

410D 7E MOV A, M

410E D3, 0D OUT BPRT

4110 CD, 1B, 41 CALL DELAY

4113 23 INX H

4114 0D DCR C
4115 C2, 09, 41 JNZ LOOP1

4118 C3, 00,41 JMP START

411B C5 DELAY PUSH B

411C 0E, 05 MVI C, 05

411E 11, FF, FF LOOP3 LXI D FFFF

4121 1B LOOP2 DCX D

4122 7A MOV A, D

4123 B3 ORA E

4124 C2, 21,41 JNZ LOOP2

4127 0D DCR C

4128 C2, 1E, 41 JNZ LOOP3

412B C1 POP B

412C C9 RET

DATA:

4500 80 1A A1 64

4504 A4 81 5A 64

4508 54 8A B1 A8

450C B4 88 DA 68

4510 D8 1A E8 46

4514 E8 83 78 86

74

RESULT: -

Thus the rule for Traffic Light Controller was executed by Assembly Language program.
Ex. No: 16 STEPPER MOTOR INTERFACING

AIM:

To write a program for inter facing stepper motor and to run the motor
in different directions and in different speeds.

ALGORITHM:

Step1: Start the program.


Step2: Load HL register pair with memory address at look up.
Step3: Move the contents of HL pair to accumulator.
Step4: Out the contents of accumulator to run the motor.
Step5: Decrease b register. If register content is not zero then rotate the motor
continuously.
Step6: If zero then move to the Seginning of the program.
Step7: Stop the process.

THEORY:

STEPPER MOTOR:
A motor in which the rotor is able to assume only discrete stationary angular
position is a Stepper Motor. The rotary motion in a stepper motor is a stepwise
manner from one equilibrium position to another.

CONSTRUCTIONAL FEATURES:
A stepper motor could be either of the reluctance type or of the permanent
magnet type (PM). A PM stepper consists of multiphase stator and two part
permanent magnet rotor. The VR stepper motor has unmagnetised rotor. PM stepper
motor is the most commonly used type. The basic two phase stepper motor consists of
two pairs of stator poles. Each of the four poles has its own winding. The excitation

MP & MC – LAB MANUAL ECE Page | 101


of any winding generates a north pole (N), a south pole (S) gets induced at the
diametrically opposite side.

As shown in the figure the four pole structure is continuous with the stator
frame and the magnetic field passes through the cylindrical stator annular ring. The
rotor magnetic system has two end faces. The left face is permanently magnetized as
South Pole and their right face as North Pole. The South Pole structure and the North
Pole structure posses similar pole faces. The north pole structure is twisted with
respect to the south pole structure by one pole pitch.

Stepper Motor Cross-sectional View

MP & MC – LAB MANUAL ECE Page | 102


In an arrangement where four stator poles and three poles of rotor poles, there exists
12 possible positions in which a south pole of the rotor can lock with a north pole of
the stator. From this it can be rotated that the step size is
o
360
=
Ns*Nr
where, Ns is the number of stator pole pairs
Nr is the number of pairs rotor pole
Generally step size of the stepper motor depends upon NR. These stable
positions can be attained by simply energizing the winding on any one of the stator
poles with a DC. There are three different schemes available for ‘stepping’ a stepper
motor. They are,
a) Wave Scheme
b) 2-Phase scheme
c) Half stepping or mixed scheme

2-PHASE SCHEME:
In this scheme any two adjacent stator windings are energized. There are two
magnetic fields active in quadrature and none of the rotor pole faces can in direct
alignment with the stator poles. A partial but symmetric alignment of the rotor poles
is of course possible.

MP & MC – LAB MANUAL ECE Page | 103


Typical equilibrium conditions of the rotor when the windings on two
successive stator poles are excited are illustrated. In Step (a) A1 and B1 are
energized. The pole-face S1 tries to align itself with the axis of A1 (N) and the pole-
face S2 with B1 (N). The North Pole N3 of the rotor finds itself in neutral zone
between A1 (N) and B1 (N). S1 and S2 of the rotor position themselves
symmetrically with respect to the two stator north pole.
Next when B1 and A2 are energized S2 tends to align with B1 (N) and S3
with A2 (N) of course. Again under equilibrium conditions only partial alignment is
possible and N1 finds itself in the neutral region midway between B1 (N) and A2 (N)
[Step (b)]. In Step (c), A2(N) and B2(N), respectively, with N2 in the neutral zone.
Step (d) illustrates the case when A1 and B2 are ON.
The step angle is 30ْ as in the two phase’s scheme. However the rotor is offset
by 15ْ in the two phase’s scheme with respect to the wave scheme. A total of 12 steps
are required to move the rotor by 360ْ (mechanical) Two Phases drives produce more
torque than the wave drives.

MNEMONICS:
START: LXI H, LOOK UP
MVI B, 04
REPT: MOV A, M
OUT 0C0H
LXI D, 0303H
DELAY: NOP DCX
D
MOV A, E
ORA D
JNZ DELAY
INX H
DCR B
JNZ REPT
JMP START
LOOK UP: DB 09 05 06 0A
MP & MC – LAB MANUAL ECE Page | 104
TAB
LE:
1 LOOK UP TABLE

Anticlockwise Clockwise
Step A1 A2 B1 B2 A1 A2 B1 B2
1 1 0 0 1 1 0 1 0
2 0 1 0 1 0 1 1 0
3 0 1 1 0 0 1 0 1
4 1 0 1 0 1 0 0 1

TABLE: 2

Mnemonics Description
Memory Label HE
Instruc Operand X
4100 tion
START: LXI H, LOOK 21 Load HL pair with memory address
4101 UP 1A at Look Up
4102 41
4103 MVI 06 Move immediate the given data
4014 B,04 04 to B register
4105 REPT: MOV 7E Move content of memory to Acc.
4106 MOV A,M 03 Out the content of Accumulator
4107 [2000], AX C0 to C0 port address
4108 LXI 11 Load the data 0303H to D register
4109 D, 0303H 03
410A 03
410B DELAY: NOP 00 Perform No operation
410C DCX 1B Decrement address of DE pair
410D MOV D 7B once Move E register content to
410E ORA A,E B2 Acc. Perform OR operation With
410F JNZ D C2 Acc. Jump on no zero to the
4110 410B 0B instruction at specified memory
MP & MC – LAB MANUAL ECE Page | 105
4111 41 Address
4112 INX H 23 Increment HL pair address once
4113 DCR B 05 Decrement B register content
4114 JNZ C2 once Jump on no zero to the
4115 05 instruction at specified memory
4116 41 Address
4117 JMP START C3 Jump to the instruction at
4118 00 specified memory
4119 41
411A LOOK UP 09 Data will be stored in the location
05
06
04

RESULT:
Thus the stepper motor is rotated by varying the speed using COUNT
operation and its direction is also changed using program written and executed using
8085 micro processor kit.
EX.NO.:17 PROGRAMMING USART/TIMER

Aim: -
To program counter 2 of 8253 to generate Square wave & To transmitted data

the given the location.

Apparatus Required:

1. One 8085-microprocessor kit

2. + 5 v Power supply

3. USART interface board

HARDWARE DESCRIPTION:

8251 is Universal Synchronous, Asynchronous Receiver and Transmitter

(USART). It allows full duplex transmission and reception. It provides double buffering of

data both in the transmission and receiver section. It provides error detection logic, which

detects parity overrun and framing errors. It has Modem control Logic, which supports

basic set control signals.

In this experiment an USART interface board is connected to the p kit. The board

comprises of Timer (8253) IC & USART (8251) IC. Timer provides necessary Baud rate to
USART. From the processor data is transmitted to the interface board. USART now act as
a receiver to receive the data. Then it transmits the same data back to the kit. The
received data is stored at particular location.

Procedure:

1. Connect the inter face board with the p kit.


2. Enter the initializing and transmitting program in one location.
3. Enter the receiving program in another location.
4. Execute the form program first followed by the second program.
5. See the transmitted data in the specified memory location in the second
.

Program: program
START: MVI A, 36 START: IN CO

OUT CE STA 4150H


MVI A, 0A RST1

OUT C8

MVI A, 00

OUT C8

MVI A, 4E

OUT C2

MVI A, 37

OUT C2

MVI A, 41

OUT C0

RST 1

Program (For initialization and Transmission)

Address Op-Code Label Mnemonics Comments

4100 3E, 36 START MVI A, 36 Mode set for 8253

4102 D3, CE OUT CE Control reg. of 8253

4104 3E, 0A MVI A, 0A LSB value

4106 D3, C8 OUT C8 Count reg. Of 8253

4108 3E, 00 MVI A, 00 MSB value

410A D3, C8 OUT C8

410C 3E, 4E MVI A, 4E Mode for 8251

410E D3, C2 OUT C2 Control reg. of 8251

4110 3E, 37 MVI A, 37 Command Instruction of 8251.

4112 D3, C2 OUT C2


4114 3E, 41 MVI A, 41 Send data

4116 D3, C0 OUT C0 Data reg. of 8251

118 CF RST 1

Program (For Reception)

Address Op-Code Label Mnemonics Comments

4200 DB, C0 START IN C0 Move data from C0 to Acc

4202 32, 50, 41 STA 4150H Store Acc value in Memory

CF RST 1

Execute the Transmitter program first. Data is transmitted to USART. Now execute

reception program and see at location 4150. The transmitted data will available.

TIMER:
Program:

START: MVI A, 36

OUT CE

MVI A, 0A

OUT C8

MVI A, FF

OUT C8

HLT

Address Op-Code Label Mnemonics Comments

4100 3E, 36 START MVI A, 36 Mode set for 8253

4102 D3, CE OUT CE Control reg. of 8253

4104 3E, 0A MVI A, 0A LSB value

4106 D3, C8 OUT C8 Count reg. Of 8253

4108 3E, 00 MVI A, FF MSB value

410A D3, C8 OUT C8

410C 76 HLT

Ex. No: 18 INTERFACING KEYBOARD DISPLAY CONTROLLER ( 8279)


INTRODUCTION:
The INTEL 8279 is responsible for debouncing of the keys,
coding of the keyboard matrix and refreshing of the display elements in a
microprocessor based development system.
Its main features are
• Simultaneous keyboard and display operation.
• Three input modes such as scanned keyboard mode , scanned sensor mode
and stored input entry mode.
• R output mode such as 8 or 16 bit character multiplexed display right entry or
left entry display format.
• Clock puscalar
• Programmable scan timing
• 2 key increment facility for easy programming.
• Auto increment facility for easy programming.
• The 8279 is designed specifically to connect to any CPU to do some other
Work other than scanning the keyboard and refreshing the display. This CPU
can program the operating modes for 8279.It uses the CS, A0, RD and WR
lines to control data. How to and from various internal registers and buffer as
given in table.

SEGMENT DEFINITION:
Segment definitions of the seven segment display are shown below. The
correspondence between the data bus and output port bits 8279.Also the segment
relationship with these given in table 1.

MP & MC – LAB MANUAL ECE Page | 110


D0 bit of the byte sent to the display RAM corresponds to B0 and D7 of the
byte sent to the display corresponds AB. Inorder to right up a segment the
corresponding bit of data are written into the RAM should be a 0.

DISPLAY MODE SETUP:

DD DISPLAY MODE:
00-8 8 bit character display-left entry
01-16 8 bit character display- left entry
10-8 8 bit character display- right entry
11-16 8 bit character display-right entry

Kkk-KEYBOARD MODE:
000-Encoded scan keyboard-2 KEY LOCK OUT
001-Encoded scan keyboard-2 KEY LOCK OUT
010-Encoded scan keyboard-N key roll over
011-Decoded scan sensor matrix
100- Decoded scan keyboard –N key roll over
101- Decoded scan sensor matrix
110-Strobed input, Encoded Display scans
111-Strobed input, decoded display scan

WRITE DISPLAY RAM:


The write display RAM command word format is shown in table
1.AI auto increment flag .If AI=1,the row address selected will be incremented after
the each following read or write to the DISPLAY RAM
AAAA - select any one of the 16 rows of DISPLAY RAM.

MP & MC – LAB MANUAL ECE Page | 111


READ FIFO STATUS:
The status word is read by the CPU when A0 is high and CS and RD are low.
FIFO status is used in the keyboard and strobed input modes to indicate whether an
error has occurred. There are two types of errors possible over run and under run over
run occur. when the entry of another character in to a full. FIFO is attempted. Under
RUN across when the CPU tried to read an empty FIFO. The FIFO status word also
has been at bit to indicate that the display RAM is unavailable because a clear display
or clear all comment has not completed is cleaning operation. The use of this flag is
clear the display.

In a sensor matrix SIE bit act as error flag and indicates whether a
simultaneous multiple closure error has occurred.SIE bit is set in FIFO status word to
indicate at least one sensor closure indication is contained in the sensor RAM.

READ FIFO/SENSOR RAM:

READ FIFO/SENSOR RAM control, word format is


given in a table 2. The CPU sets the 8279 for a read of the FIFO1 sensor RAM by
writing command word.
X - Don’t care
AI – auto increment flag irrelevant is scanned keyboard mode. For sensor
matrix mode. If AI=1, then successive read will be from subsequent row of the sensor
RAM.
AAA- In scanned keyboard mode, the 8279 will automatically drive the data bus for
subsequent read in the same sequence in which data first entered the FIFO.

READ A KEY:
PROCEDURE:
Set FIFO status check for a key and repeat the loop. Set 8279 for A and of
read of FIFO RAM store the content of accumulator at the memory address 4200
CNT EQU 0C2H; DAT EQU 0C0H.

MP & MC – LAB MANUAL ECE Page | 112


MNEMONICS:
ORG 4100H
LOO IN CNT
ANI 07
JZ LOOP
MVI A, 40H
OUT CNT
IN DAT
STA 4200
HLT

OBSERVATION:
The key 0 is pressed and the data entered at FIFO RAM is W.

ROUTING DISPLAY:
PROCEDURE:
The initialization of 8279 to display the characters. The data is fetched from
address 412CH and displayed in the second digit of the display. Since in the
command word for “write display”. RAM the auto increment flag is set. A time delay
is given between successive digit to likely display.

MNEMONICS:

START LXI 412CH


MVI D,OFH
MVI A,10F
OUT 0C2H
MVI A,0CCH
OUT 0C2H
LOOP MOV A,M
OUT 0C0H

MP & MC – LAB MANUAL ECE Page | 113


CALL DELAY INX
H
DCR D JNZ
LOOP JMP
START
DELAY MVI B,0A0H
LOOP1 MVI C,0FFH
LOOP2 DCR C
JNZ LOOP2
DCR C JNZ
LOOP1
RET

OBSERVATION:
The rolling message ‘HELP US’ is displayed in the display when the input
given is
412C FF FF FF FF
4130 FF FF FF FF
4134 98 68 70 08
4138 1C 29 FF FF

RESULT:
Thus a program to read akey and rolling display by interfacing 8085 with 8279 is
executed and the output is verified.

MP & MC – LAB MANUAL ECE Page | 114


MP & MC – LAB MANUAL ECE Page | 115
EX,NO.19 KEY BOARD INTERFACING (8279) USING 8051

Aim: -

a). To initialize 8279 and to display the character ‘A’ in the first digit of the display.

Apparatus Required

1. One 8051-microcontroller kit

2. 8279 interface board

8279 Description:

The Intel 8279 is responsible for denouncing of the key coding of the pad matrix and
refreshing of the display elements in microprocessor based development system. Its main
features are:

1. Simultaneous keyboard and display operation.


2. 3 input modes such as scanned keyboard mode Scanned sensor Mode and strobe input
Enter mode.
3. 2 output modes such as 8 or 61 character multiplexed displays, right entry or left entry
display formats.
4. Clock prescaler.
5. Programmable Scan Timing.
6. 2 key lockout or N – key rollover with contact denounces.
7. Auto increment facility for easy programming.

Procedure:

o Connect power supply (+5) to 8085 p kit.


o Connect 8279 interface board to the kits
o Power non the system.
o Enter & execute the program.

(i). Display Character:-

MOV DPTR, #FFC2

MP & MC – LAB MANUAL ECE Page | 116


MOV A, #00

MOVX @DPTR, A

MOV A, #CC

MOVX @DPTR, A

MOV A, #90

MOVX @DPTR, A

MOV DPTR, # FFC0

MOV A, #88

MOVX @ DPTR, A

MOV R0, #05

MOV A, #FF

LOOP: MOVX @DPTR, A

DJNZ R0, LOOP

HERE: SJMP HERE

Display Character:-

ADDERS OPCODE LABLE MNEMONICS COMMENTS

4100 90,FF,C2 MOV DPTR, #FFC2

4103 74,00 MOV A, #00

4105 F0 MOVX @DPTR, A

4106 74,CC MOV A, #CC

4108 F0 MOVX @DPTR, A

4109 74,90 MOV A, #90

410B F0 MOVX @DPTR, A

MP & MC – LAB MANUAL ECE Page | 117


410C 90,FF,C0 MOV DPTR, # FFC0

410F 74,88 MOV A, #88

4111 F0 MOVX @ DPTR, A

4112 78,05 MOV R0, #05

4114 74,FF MOV A, #FF

4116 F0 LOOP MOVX @DPTR, A

4117 D8,FD DJNZ R0, LOOP

4119 80,FE HERE SJMP HERE

MP & MC – LAB MANUAL ECE Page | 118


Rolling Display:-

START: MOV DPTR, #FFC2

MOV R0, # 00

MOV R1, # 44

MOV A, # 10

MOVX @DPTR, A

MOV A, #CC

MOVX @DPTR, A

MOV A, # 90

MOVX @DPTR, A

LOOP: MOV DPH, R1

MOV DPL, R0

MOVX A, @DPTR

MOV DPTR, # FFCO

MOVX @DPTR, A

LCALL DELAY

INC R0

CJNE R0, # 0F LOOP

LJMP START

LOOK – UP TABLE:-

4400 FF FF FF FF

4404 FF FF FF FF

MP & MC – LAB MANUAL ECE Page | 119


4408 98 68 7C C8

440C FF 1C 29 FF

Delay Subroutine:-

MOV R4, # A0

LOOP2: MOV R5, # FF

LOOP1: NOP

DJNZ R5, LOOP1

DJNZ R4, LOOP2

RET

Rolling Display:-

ADDERS OPCODE LABLE MNEMONICS COMMENTS

4100 90,FF,C2 START MOV DPTR, #FFC2

4103 78,00 MOV R0, # 00

4105 79,44 MOV R1, # 44 To initialize

4107 74,10 MOV A, # 10 Look up table

4109 F0 MOVX @DPTR, A At 4400

410A 74,CC MOV A, #CC

410C F0 MOVX @DPTR, A

410D 74,90 MOV A, # 90

410F F0 MOVX @DPTR, A

4110 89,83 LP MOV DPH, R1

4112 88,82 MOV DPL, R0

MP & MC – LAB MANUAL ECE Page | 120


4114 E0 MOVX A, @DPTR

4115 90,FF,C0 MOV DPTR,# FFCO

4118 F0 MOVX @DPTR, A

4119 12,45,00 LCALL DELAY Delay at 4500

411C 08 INC R0

411D B8,0F,F0 CJNE R0, # 0F LP

4120 02,41,00 LJMP START

Subroutine:-

ADDERS OPCODE LABLE MNEMONICS COMMENTS

4500 7C,A0 MOV R4, # A0

4502 7D,FF LOOP2 MOV R5, # FF

4504 00 LOOP1 NOP

4505 DD,FD DJNZ R5, LOOP1

4507 DC,F9 DJNZ R4, LOOP2

4509 22 RET

MP & MC – LAB MANUAL ECE Page | 121


EX.NO.20 INTERFACING DAC WITH 8051
Aim: -

To connect DAC at 8255 ports and to generate the following waves

a). Square – wave (DAC2)

b). Saw – tooth wave (DAC1)

c). Triangular wave (DAC2)

(i). Square – wave:

MOV DPTR, # FFC8

START: MOV A, # 00

MOVX @DPTR, A

LCALL DELAY

MOV A, # FF

MOVX @ DPTR, A

LCALL DELAY

LJMP START

DELAY: MOV R1, 05

LOOP: MOV R2, # FF

HERE: DJNZ R2, HERE

DJNZ R1, LOOP

RET

SJMP START

ADDERS OPCODE LABLE MNEMONICS COMMENTS

4100 90, FF, C8 MOV DPTR, # FFC8

MP & MC – LAB MANUAL ECE Page | 122


4103 74,00 START MOV A, # 00

4105 F0 MOVX @DPTR, A

4106 12,41,12 LCALL DELAY

4109 74,FF MOV A, # FF

410B F0 MOVX @ DPTR, A

410C 12,41,12 LCALL DELAY

410F 02,41,03 LJMP START

4112 79,05 DELAY MOV R1, 05

4114 7A,FF LOOP MOV R2, # FF

4116 DA,FE HERE DJNZ R2, HERE

4118 D9,FA DJNZ R1, LOOP

411A 22 RET

411B 80,E3 SJMP START

(ii). Saw – Tooth wave:

MOV DPTR, # FFC0

MOV A, # 00

LOOP: MOVX @DPTR, A

INC A

SJMP LOOP

ADDERS OPCODE LABLE MNEMONICS COMMENTS

MP & MC – LAB MANUAL ECE Page | 123


4100 90,FF,C0 MOV DPTR, # FFC0

4103 74,00 MOV A, # 00

4105 F0 LOOP MOVX @DPTR, A

4106 04 INC A

4107 80,FC SJMP LOOP

(iii). Triangular wave:

MOV DPTR, # FFC8

START: MOV A, # 00

LOOP1: MOVX @DPTR, A

INC A

JNZ LOOP1

MOV A, # FF

LOOP2: MOVX @ DPTR, A

DEC A

JNZ LOOP2

LJMP START

ADDERS OPCODE LABLE MNEMONICS COMMENTS

4100 90,FF,C8 MOV DPTR, # FFC8

4103 74,00 START MOV A, # 00

4105 F0 LOOP1 MOVX @DPTR, A

4106 04 INC A

4107 70, FC JNZ LOOP1

4109 74, FF MOV A, # FF

MP & MC – LAB MANUAL ECE Page | 124


410B F0 LOOP2 MOVX @ DPTR, A

410C 14 DEC A

410D 70,FC JNZ LOOP2

410F 02,41,03 LJMP START

MP & MC – LAB MANUAL ECE Page | 125


RESULT:

EX.NO.21 TRAFFIC LIGHT CONTROL SYSTEM USING 8051

Aim: -

To write an assembly language program to simulate a real traffic light system.

Apparatus Required: -

1. 8051 – Microcontroller kit,


2. Traffic Light interface Board,
ALOGRITHM: -

1. Load the reg., pair immediately.


2. Move immediately the C reg., to E and then move to acc.
3. The content of acc is occupied to specified port.
4. Increment HL pair of one bit and then move.
5. The contents of acc are occupied A port, move memory to acc.
6. Increment HL reg., pair by one bit and then move memory to acc.
7. The contents of acc are copied to B port.
8. The program execution is transformed to specified address.
9. Decrement C reg., pair and jump to specified address.
10. Move the data in C reg., and jump to specified loop.
11. Decrement D reg., pair and move D reg., to A reg.
12. The contents of E reg., logically OR with acc.
13. Jump to specified loop and decrement C reg., pair.
14. Jump to specified loop.
15. The program sequence is transfer from subroutine to calling program.

MP & MC – LAB MANUAL ECE Page | 126


Program:-

START: MOV DPTR, #DATA

MOV R2, #0C

MOVX A, @DPTR

PUSH DPH

PUSH DPL

MOV DPTR, #FF0F

MOVX @DPTR, A

POP DPL

POP DPH

INC DPTR

LOOP1: MOVX A, @DPTR

PUSH DPH

PUSH DPL

MOV DPTR, #FF0C

MOVX @DPTR, A

MP & MC – LAB MANUAL ECE Page | 127


POP DPL

POP DPH

INC DPTR

MOVX A, @DPTR

PUSH DPH

PUSH DPL

MOV DPTR, #FF0D

MOVX @ DPTR, A

LCALL DELAY

POP DPL

POP DPH

INC DPTR

DJNZ R2, LOOP1

LJMP START

DELAY: MOV R7, #10

LOOP4: MOV R5, #0FFH

LOOP3: MOV R6, #0FFH

LOOP2: NOP

NOP

DJNZ R6, LOOP2

DJNZ R5, LOOP3

DJNZ R7, LOOP4

RET

DATA: 4500 80 1A A1 64

MP & MC – LAB MANUAL ECE Page | 128


4504 A4 81 5A 64

4508 54 8A B1 A8

450C B4 88 DA 68

4510 D8 1A E8 46

4514 E8 83 78 86

74

EX.NO.22 STEPPER MOTOR INTERFACING WITH 8051

AIM:

To interface a stepper motor with 8051 microcontroller and operate it.

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 step-wise manner from one equilibrium position to
the next. Stepper Motors are used very wisely in position control systems like printers, disk
drives, process control machine tools, etc.

The basic two-phase stepper motor consists of two pairs of stator poles. Each of the four
poles has its own winding. The excitation of any one winding generates a North Pole. A South
Pole gets induced at the diametrically opposite side. The rotor magnetic system has two end
faces. It is a permanent magnet with one face as South Pole and the other as North Pole.

The Stepper Motor windings A1, A2, B1, B2 are cyclically excited with a DC current to
run the motor in clockwise direction. By reversing the phase sequence as A1, B2, A2, B1,
anticlockwise stepping can be obtained.

2-PHASE SWITCHING SCHEME:

In this scheme, any two adjacent stator windings are energized. The switching scheme is
shown in the table given below. This scheme produces more torque.

MP & MC – LAB MANUAL ECE Page | 129


ANTICLOCKWISE CLOCKWISE
STEP A1 A2 B1 B2 DATA STEP A1 A2 B1 B2 DATA

1 1 0 0 1 9h 1 1 0 1 0 Ah

2 0 1 0 1 5h 2 0 1 1 0 6h

3 0 1 1 0 6h 3 0 1 0 1 5h

4 1 0 1 0 Ah 4 1 0 0 1 9h

ADDRESS DECODING LOGIC:

The 74138 chip is used for generating the address decoding logic to generate the device
select pulses, CS1 & CS2 for selecting the IC 74175.The 74175 latches the data bus to the
stepper motor driving circuitry.

Stepper Motor requires logic signals of relatively high power. Therefore, the interface
circuitry that generates the driving pulses use silicon darlington pair transistors. The inputs for
the interface circuit are TTL pulses generated under software control using the Microcontroller
Kit. The TTL levels of pulse sequence from the data bus is translated to high voltage output
pulses using a buffer 7407 with open collector.

MP & MC – LAB MANUAL ECE Page | 130


PROGRAM :

Address OPCODES
Label Comments
ORG 4100h

4100 START: MOV DPTR, #TABLE Load the start


address of switching
scheme data TABLE
into Data Pointer
(DPTR)

4103 MOV R0, #04 Load the count in R0

4105 LOOP: MOVX A, @DPTR Load the number in


TABLE into A

4106 PUSH DPH Push DPTR value to


Stack
4108 PUSH DPL

410A MOV DPTR, #0FFC0h Load the Motor port


address into DPTR

410D MOVX @DPTR, A Send the value in A


to stepper Motor port
address

410E MOV R4, #0FFh Delay loop to cause


a specific amount of
4110 DELAY MOV R5, #0FFh time delay before
: next data item is sent
4112 DELAY DJNZ R5, DELAY1 to the Motor
1:

4114 DJNZ R4, DELAY

4116 POP DPL POP back DPTR


value from Stack
4118 POP DPH

411A INC DPTR Increment DPTR to


point to next item in
the table

MP & MC – LAB MANUAL ECE Page | 131


411B DJNZ R0, LOOP Decrement R0, if not
zero repeat the loop

411D SJMP START Short jump to Start


of the program to
make the motor
rotate continuously

411F TABLE: DB 09 05 06 0Ah Values as per two-


phase switching
scheme

PROCEDURE:

Enter the above program starting from location 4100.and execute the same. The stepper
motor rotates. Varying the count at R4 and R5 can vary the speed. Entering the data in the look-
up TABLE in the reverse order can vary direction of rotation.

RESULT:

Thus a stepper motor was interfaced with 8051 and run in forward and reverse directions
at various speeds.

MP & MC – LAB MANUAL ECE Page | 132


EX.NO.:23 PROGRAMMING USART (8251)

Aim: -

To transmit and receive a character using 8051.

Apparatus Required:-

1. One 8051-microcontroller kit

2. USART interface board

HARDWARE DESCRIPTION:

8251 is Universal Synchronous, Asynchronous Receiver and Transmitter (USART). It


allows full duplex transmission and reception. It provides double buffering of data both in the
transmission and receiver section. It provides error detection logic, which detects parity overrun
and framing errors. It has Modem control Logic, which supports basic set control signals.

In this experiment an USART interface board is connected to the p kit. The board
comprises of Timer (8253) IC & USART (8251) IC. Timer provides necessary Baud rate to
USART. From the processor data is transmitted to the interface board. USART now act as a
receiver to receive the data. Then it transmits the same data back to the kit. The received data is
stored at particular location.

Procedure:

1. Connect the inter face board with the p kit.


2. Enter the initializing and transmitting program in one location.
3. Enter the receiving program in another location.
4. Execute the form program first followed by the second program.
5. See the transmitted data in the specified memory location in the second program.

Program:

MOV A, # 36 MOV DPTR, #4200

MOV DPTR, # FFCE MOVX @ DPTR, A

MOVX @DPTR, A HERE: SJMP HERE


MP & MC – LAB MANUAL ECE Page | 133
MOV A, # 0A

MOV DPTR, # FFC8

MOVX @DPTR, A

MOV A, # 00

MOVX @DPTR, A

MOV A, # 4E

MOV DPTR, FFC2

MOVX @DPTR, A

MOV A, # 37

MOVX @DPTR, A

MOV A, # 41

MOV DPTR, FFC0

MOVX @DPTR, A

MOVX A, @DPTR

ADDERS OPCODE LABLE MNEMONICS COMMENTS

4100 74, 36 MOV A, # 36

4102 90, FF, CE MOV DPTR, # FFCE

4105 F0 MOVX @DPTR, A

4106 74, 0A MOV A, # 0A

4108 90, FF,C8 MOV DPTR, # FFC8

410B F0 MOVX @DPTR, A

410C 74,00 MOV A, # 00

410E F0 MOVX @DPTR, A

410F 74, 4E MOV A, # 4E

4111 90,FF,C2 MOV DPTR, FFC2

4114 F0 MOVX @DPTR, A

MP & MC – LAB MANUAL ECE Page | 134


4115 74,37 MOV A, # 37

4117 F0 MOVX @DPTR, A

4118 74,41 MOV A, # 41

411A 90,FF, C0 MOV DPTR, FFC0

411D F0 MOVX @DPTR, A

411E E0 MOVX A, @DPTR

411F 90,42,00 MOV DPTR, #4200

4122 F0 MOVX @ DPTR, A

4123 80,FE HERE SJMP HERE

RESULT:-

Execute the Transmitter program first. Data is transmitted to USART. Now execute reception
program and see at location 4150. The transmitted data will available.

MP & MC – LAB MANUAL ECE Page | 135


MP & MC – LAB MANUAL ECE Page | 136
COMMUNICATION BETWEEN PC & KIT USING 8051

I) PROGRAM TO DISPLAY ‘A’

MOV TMOD, #20H

MOV TH1, #FDH

MOV SCON, #50H

SETB TR1

START: MOV SBUF, # ‘A’

HERE: JNB.T1, HERE

CLR T1

SJMP.START

II) PROGRAM TO DISPLAY ‘YES’

MOV TMOD, #20H

MOV TH1, #FDH

MOV SCON, #50H

SETB TR1

AGAIN: MOV A, #’Y’

ACALL TRANS

MOV A, #’E’

ACALL TRANS

MOV A, #’S’

ACALL TRANS

SJMP AGAIN
TRANS: MOV SBUF, A

HERE: JNB TI, HERE

CLR TI

RET

NOTE:

ASCII VALUE

A-41, Y-59, E-45, S-53,

TMOD-89 TH1-8D SCON-98

TR1-8E, TI-00

You might also like