Eee - MP MC Lab Manual
Eee - MP MC Lab Manual
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-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
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
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
4111 42
RESULT:
Thus the addition and subtraction of two 8-bit numbers using 8085
microprocessor was performed successfully
APPARATUS REQUIRED:
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
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
OUTPUT:
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
RESULT:
Thus an assembly language program to divide and multiply two 8 bit data’s
was written and executed using 8085 microprocessor kit.
AIM:
APPARATUS REQUIRED:
:
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.
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
OUTPUT:
5300: 77 5500: 10
5301: 88 5501: 9A
5302: 99 5502: 00
5303: 11
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
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
SAMPLE INPUT/OUTPUT:
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.
AI
M:
To find the smallest and largest among N numbers using
8085
microprocessor.
APPARATUS REQUIRED:
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
TABLE 1:
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:
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.
OUTPUT:
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
TABLE: 2
OUTPUT:
RESULT:
Thus the Ascending and Descending order of given N- numbers was
performed and their output was verified.
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
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
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
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:
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
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
OUTPUT:
RESULT:
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
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.
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:
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:
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 | 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
[
3
0
0
2
]
M
U
L
C
X
M
O
V
[
2
0
0
0
]
,
A
X
[
2
0
0
2
]
,
D
X
H
L
T
OUTPUT:
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:
RESULT:
AI
M:
To write an assembly language program to add the two
16 bit data’s using
8051 Micro controller.
APPARATUS REQUIRED:
ALGORITHM:
OUTPUT:
RESULT:
Thus an assembly language program to add two 16-bit data’s was written and
executed using 8051 micro controller kit.
AI
M:
To write an assembly language program to subtract the
two 16 bit data’s using
8051 Micro controller.
APPARATUS REQUIRED:
ALGORITHM:
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
OUTPUT:
RESULT:
Thus an assembly language program to subtract two 16-bit data’s was written
and executed using 8051 micro controller kit.
AI
M:
To write an assembly language program to multiply two
16 bit data’s using
8051 Micro controller.
APPARATUS REQUIRED:
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
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:
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
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:
Apparatus Required:
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
410E AF XRA A
Result:
Thus ADC interfacing with 8085 microprocessor kit to generate digital output is
done
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
4115 0D L2 DCR C
4119 05 DCR B
411D C9 RET
PROGRAM: -
ORG 4100
START: MVI A, 00
INR A
JNZ L1
JMP START
3C INR A
(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
4102 7D L1 MOV A, L
4105 2C INR L
410B 7D L2 MOV A, L
410E 2D DCR L
PROGRAM: -
(Step wave)
ORG 4100H
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
ORG 4100H
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
The program to verify all wave forms for using DAC and written the program
Aim: -
Apparatus Required: -
ALOGRITHM: -
ORG 4100 H
CNT EQU 0F H
APRT EQU 0C H
BPRT EQU 0D H
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
4105 7E MOV A, M
4108 23 INX H
410C 23 INX H
410D 7E MOV A, M
4113 23 INX H
4114 0D DCR C
4115 C2, 09, 41 JNZ LOOP1
4122 7A MOV A, D
4123 B3 ORA E
4127 0D DCR C
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:
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
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.
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.
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
Apparatus Required:
2. + 5 v Power supply
HARDWARE DESCRIPTION:
(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
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:
Program: program
START: MVI A, 36 START: IN CO
OUT C8
MVI A, 00
OUT C8
MVI A, 4E
OUT C2
MVI A, 37
OUT C2
MVI A, 41
OUT C0
RST 1
118 CF RST 1
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
410C 76 HLT
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.
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
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 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.
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:
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.
Aim: -
a). To initialize 8279 and to display the character ‘A’ in the first digit of the display.
Apparatus Required
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:
Procedure:
MOVX @DPTR, A
MOV A, #CC
MOVX @DPTR, A
MOV A, #90
MOVX @DPTR, A
MOV A, #88
MOVX @ DPTR, A
MOV A, #FF
Display Character:-
MOV R0, # 00
MOV R1, # 44
MOV A, # 10
MOVX @DPTR, A
MOV A, #CC
MOVX @DPTR, A
MOV A, # 90
MOVX @DPTR, A
MOV DPL, R0
MOVX A, @DPTR
MOVX @DPTR, A
LCALL DELAY
INC R0
LJMP START
LOOK – UP TABLE:-
4400 FF FF FF FF
4404 FF FF FF FF
440C FF 1C 29 FF
Delay Subroutine:-
MOV R4, # A0
LOOP1: NOP
RET
Rolling Display:-
411C 08 INC R0
Subroutine:-
4509 22 RET
START: MOV A, # 00
MOVX @DPTR, A
LCALL DELAY
MOV A, # FF
MOVX @ DPTR, A
LCALL DELAY
LJMP START
RET
SJMP START
411A 22 RET
MOV A, # 00
INC A
SJMP LOOP
4106 04 INC A
START: MOV A, # 00
INC A
JNZ LOOP1
MOV A, # FF
DEC A
JNZ LOOP2
LJMP START
4106 04 INC A
410C 14 DEC A
Aim: -
Apparatus Required: -
MOVX A, @DPTR
PUSH DPH
PUSH DPL
MOVX @DPTR, A
POP DPL
POP DPH
INC DPTR
PUSH DPH
PUSH DPL
MOVX @DPTR, A
POP DPH
INC DPTR
MOVX A, @DPTR
PUSH DPH
PUSH DPL
MOVX @ DPTR, A
LCALL DELAY
POP DPL
POP DPH
INC DPTR
LJMP START
LOOP2: NOP
NOP
RET
DATA: 4500 80 1A A1 64
4508 54 8A B1 A8
450C B4 88 DA 68
4510 D8 1A E8 46
4514 E8 83 78 86
74
AIM:
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.
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.
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
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.
Address OPCODES
Label Comments
ORG 4100h
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.
Aim: -
Apparatus Required:-
HARDWARE DESCRIPTION:
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:
Program:
MOVX @DPTR, A
MOV A, # 00
MOVX @DPTR, A
MOV A, # 4E
MOVX @DPTR, A
MOV A, # 37
MOVX @DPTR, A
MOV A, # 41
MOVX @DPTR, A
MOVX A, @DPTR
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.
SETB TR1
CLR T1
SJMP.START
SETB TR1
ACALL TRANS
MOV A, #’E’
ACALL TRANS
MOV A, #’S’
ACALL TRANS
SJMP AGAIN
TRANS: MOV SBUF, A
CLR TI
RET
NOTE:
ASCII VALUE
TR1-8E, TI-00