SRM VALLIAMMAI ENGINEERING COLLEGE
(An Autonomous Institution)
SRM NAGAR, KATTANKULATHUR
DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING
Academic year 2020-2021 Odd Semester
(Regulation 2017)
V SEMESTER-CSE
EC8681- MICROPROCESSORS AND MICROCONTROLLERS LABORATORY
LAB MANUAL
Prepared by
Dr. R.Arivalahan / Assoc. Professor
Dr. S. Malathi/ AP(Sel.G)
Mr. S. Balaji / AP(O.G)
Mr. P.Tamilarasan / AP(O.G)
Ms.G.Shanthi / AP(O.G)
Mr. M. Kamalakannan / AP(O.G)
Downloaded from: annauniversityedu.blogspot.com
SYLLABUS
OBJECTIVES:
To Introduce ALP concepts, features and Coding methods
Write ALP for arithmetic and logical operations in 8086 and 8051
Differentiate Serial and Parallel Interface
Interface different I/Os with Microprocessors
Be familiar with MASM
LIST OF EXPERIMENTS
8086 Programs using kits and MASM
1. Basic arithmetic and Logical operations
2. Move a data block without over lap
3. Code conversion, decimal arithmetic and Matrix operations.
4. Floating point operations, string manipulations, sorting and searching
5. Password checking, Print RAM size and system date
6. Counters and Time Delay
Peripherals and Interfacing Experiments
7. Traffic light control
8. Stepper motor control
9. Digital clock
10.Key board and Display
11.Printer status
12. Serial interface and Parallel interface
13. A/D and D/A interface and Waveform Generation.
Experiments using kits and MASM
14. Basic arithmetic and Logical operations
15. Square and Cube program, Find 2’s complement of a number
16. Unpacked BCD to ASCII
TOTAL: 45 PERIODS
Downloaded from: annauniversityedu.blogspot.com
LIST OF EXPERIMENTS
CYCLE I
1. BASIC ARITHMETIC AND LOGICAL OPERATIONS
a.16-bit data addition and subtraction
b.Multi-byte addition and subtraction
c.BCD addition and subtraction
d.16-bit multiplication and division
e.Logical operations
2. MOVE A DATA BLOCK WITHOUT OVERLAP
3. CODE CONVERSION AND DECIMAL ARITHMETIC
a.BCD to hexadecimal conversion
b.Hexadecimal to BCD
c.Hexadecimal to ASCII
d.ASCII to Hexadecimal
4. MATRIX OPERATION
5. STRING MANIPULATION
a.Copy a string
b.Reverse a string
6. SORTING
a. Ascending and Descending order
7. SEARCHING
a.Search for a given data
8. PASSWORD CHECKING PROGRAM
9. COUNTERS AND TIME DELAY
CYCLE II
1. Interfacing Traffic Light Controller with 8086
2. Interfacing Stepper Motor with 8086
3. Digital Clock in real time
4. Interfacing 8279 Keyboard / Display Controller with 8086
5. Interfacing ADC with 8086
6. Interfacing DAC with 8086
7. Parallel Communication Interface
8. Serial Communication Interface
Downloaded from: annauniversityedu.blogspot.com
INTRODUCTION TO MICROPROCESSORS & MICROCONTROLLERS
Microprocessor: is a computer processor which incorporates the functions of
a computer's central processing unit (CPU) on a single integrated circuit (IC) at most a
few integrated circuits. The microprocessor is a
multipurpose, clock driven, register based, digital-integrated circuit which
accepts binary data as input, processes it according to instructions stored in
its memory, and provides results as output. Microprocessors contain
both combinational logic and sequential digital logic. Microprocessors operate on
numbers and symbols represented in the binary numeralsystem.
Microcontroller: is a small computer on a single integrated circuit. In modern
terminology, it is a system on a chip or SoC.A microcontroller contains one or more
CPUs along with memory and programmable input/output peripherals. Program
memory in the form of Ferroelectric RAM, NOR flash or OTP ROM is also often
included on chip, as well as a small amount of RAM. Microcontrollers are designed
for embedded applications, in contrast to the microprocessors used in personal
computers or other general purpose applications consisting of various discretechips.
Downloaded from: annauniversityedu.blogspot.com
1
Ex. NO: 01
DATE:
16 BIT ADDITION USING ARITHMETIC OPERATION OF 8086 MICROPROCESSOR
AIM:
To write an assembly language program to perform addition of two 16 bit numbers
using 8086.
APPARATUS REQUIRED:
S.NO ITEM SPECIFICATION QUANTITY
1. MICROPROCESSOR KIR 8086 KIT 1
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
16- bit addition
➢ Get the first number is specificaddress.
➢ Add the second number to the firstnumber.
➢ Add the twovalues.
➢ Store the sum andcarry.
Downloaded from: annauniversityedu.blogspot.com
2
FLOW
CHART:ADDITI
ON:
Downloaded from: annauniversityedu.blogspot.com
3
PROGRAM FOR ADDITION;
ADDRESS OPCODE LABEL MNEMONICS COMMENT
1000 MOV CX,0000H Initialize counter CX
Get the first data in AX
1003 MOV AX,[1200]
register.
Get the second data in BX
1006 MOV BX, [1202]
register.
Add the contents of both
100A ADD AX,BX
the register AX & BX
100C JNC L1 Check for carry
If carry exists, increment
100E INC CX the CX
100F LI MOV [1206],CX Store the carry
1013 MOV [1204], AX Store the sum
1016 INT 3 Stop the program
OUTPUT FOR ADDITION:
ADDRESS DATA
INPUT 1200
1201
1202
1203
1204
OUTPUT 1205
1206
RESULT:
Thus the assembly language program to perform addition of two 16 bit
numbers using 8086 Performed and the result is stored.
Downloaded from: annauniversityedu.blogspot.com
4
Ex. NO: 02
DATE:
16 BIT SUBTRACTION
USING ARITHMETIC OPERATION OF 8086 MICROPROCESSOR
AIM:
To write an assembly language program to perform subtraction of two 16bit
numbers using 8086.
APPARATUS REQUIRED:
S.NO ITEM SPECIFICATION QUANTITY
1. MICROPROCESSOR KIR 8086 KIT 1
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
16- bitSUBTRACTION:
➢ Initialize the MSBs of difference to0
➢ Get the first number
➢ Subtract the second number from the firstnumber.
➢ If there is any borrow, increment MSBs of difference by1.
➢ Store LSBs ofdifference.
➢ Store MSBs ofdifference.
Downloaded from: annauniversityedu.blogspot.com
5
FLOECHART:
SUBTRACTION:
Downloaded from: annauniversityedu.blogspot.com
6
PROGRAM FOR SUBTRACTION:
ADDRESS OPCODE LABEL MNEMONICS COMMENT
1000 MOV CX,0000H Initialize counter CX
Get the first data in AX
1003 MOV AX,[1300]
register
Get the second data in BX
1006 MOV BX, [1302]
register.
Subtract the contents of both
100A SUB AX,BX the register AX & BX
100C JNC A Check the Borrow.
If carry exists, increment the
100E INC CX CX
100F MOV [1306],CX Store the Borrow.
1013 MOV [1304], AX Store the difference.
1016 INT 3 Stop the program
OUTPUT FOR SUBTRACTION:
ADDRESS DATA
1300
1301
INPUT
1302
1303
1304
OUTPUT 1305
1306
RESULT:
Thus the assembly language program to perform subtraction of two 16 bit
numbers using 8086 Performed and the result is stored.
Downloaded from: annauniversityedu.blogspot.com
7
Ex. NO: 03
DATE:
16BITMULTIPLICATIONUSINGARITHMETICOPERATIONOF8086
MICROPROCESSOR
AIM:
To write an assembly language program to perform Multiplication of two 16
bit numbers using 8086.
APPARATUS REQUIRED:
S.NO ITEM SPECIFICATION QUANTITY
1. MICROPROCESSOR KIR 8086 KIT 1
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
16- bit MULTIPLICATION
Multiplication of 16-bit numbers:
➢ Get themultiplier.
➢ Get themultiplicand
➢ Initialize the product to0.
➢ Product = product +multiplicand
➢ Decrement the multiplier by1.
➢ If multiplicand is not equal to 0, repeat from step (d) otherwise store the
product.
Downloaded from: annauniversityedu.blogspot.com
8
FLOECHART:
MULTIPLICATION:
Downloaded from: annauniversityedu.blogspot.com
9
PROGRAM FORMULTIPLICATION:
ADDRESS OPCODE LABEL MNEMONICS COMMENT
Get the first data in AX
1000 MOV AX,1234H
register.
Get the second data in BX
1003 MOV BX,0100H
register.
1006 MUL BX Multiply AX & BX data
1008 INT 3 Break point.
OUTPUT FORVMULTIPLICATION:
INPUT
OUTPUT
RESULT:
Thus the assembly language program to perform multiplication of two
16 bit numbers using 8086 Performed and the result isstored.
Downloaded from: annauniversityedu.blogspot.com
10
Ex. NO: 04
DATE:
16 BIT DIVISION USING ARITHMETIC OPERATION OF 8086 MICROPROCESSOR
AIM:
To write an assembly language program to perform division of two 16 bit
numbers using 8086.
APPARATUS REQUIRED:
S.NO ITEM SPECIFICATION QUANTITY
1. MICROPROCESSOR KIT 8086 KIT 1
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
16- bitdivision
Division of 16-bit numbers:
➢ Get the dividend and divisor.
➢ Initialize the quotient to0.
➢ Dividend =dividend–divisor
➢ If the divisor is greater, store thequotient
➢ Go to step3
➢ If dividend is greater, quotient = quotient+ repeat from step4.
Downloaded from: annauniversityedu.blogspot.com
11
FLOECHART:
DIVISION:
Downloaded from: annauniversityedu.blogspot.com
12
PROGRAM FOR DIVISION:
ADDRESS OPCODE LABEL MNEMONICS COMMENT
Get the first data in AX
1000 MOV AX,[1200]
register,
Get the second data in DX
1003 MOV DX,[1202]
register.
1007 MOV BX,[1204] Move the higher order data.
100D MOV [1206],AX Move ax register into address
Divide the dividend by
100B DIV BX
divisor
1010 MOV AX,BX Copy the lower order data
1012 MOV [1208],AX Store the higher order data.
Stop the program.
1015 INT 3
OUTPUT FOR DIVISION:
ADDRESS DATA
1200
1201
INPUT
1202
1203
1208
OUTPUT
1209
RESULT:
Thus the assembly language program to perform division of two 16 bit
numbers using 8086 Performed and the result is stored.
Downloaded from: annauniversityedu.blogspot.com
13
EX. NO: 05
DATE :
LOGICAL OPERATIONS USING 8086 MICROCONTROLLER
AIM:
To move a data block without overlap
APPARATUS REQUIRED:
S.NO ITEM SPECIFICATION QUANTITY
1. MICROPROCESSOR KIR 8086 KIT 1
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
➢Initialize the memory location to the data pointer ALRegister
➢Increment Bregister.
➢Increment accumulator by 1 and adjust it to decimal everytime.
➢Compare the given decimal number with accumulatorvalue.
➢Perform the given logical function value is in Bregister.
➢Store the resultant in memorylocation.
Downloaded from: annauniversityedu.blogspot.com
14
PROGRAM FOR “AND” LOGIC
ADDRESS OPCODE LABEL MNEMONICS COMMENT
8000 MOV AL,04 Move data 04 to AL register
8003 MOV BL,03 Move data 03 to BL register
8007 ANDIBL AND Operation
800D MOV #9000,BL Result store in 9000 address
800B HLT Stop the program
PROGRAM FOR “OR” LOGIC
ADDRESS OPCODE LABEL MNEMONICS COMMENT
8000 MOV AL,05 Move data 05 to AL register
8003 MOV BL,04 Move data 04 to BL register
8007 ORI BL OR Operation
800D MOV #9000,BL Result store in 9000 address
800B HLT Stop the program
Downloaded from: annauniversityedu.blogspot.com
15
PROGRAM FOR “EX- OR” LOGIC
ADDRESS OPCODE LABEL MNEMONICS COMMENT
8000 MOV AL,04 Move data 04 to AL register
8003 MOV BL,03 Move data 03 to BL register
8007 XOR BL EX-OR Operation
800D MOV #9000,BL Result store in 9000 address
800B HLT Stop the program
OUTPUT:
GATE INPUT OUTPUT
AND
OR
EX-OR
RESULT:
Thus the assembly language program to perform logical operations AND, OR
& EX-OR using 8086 Performed and the result is stored.
Downloaded from: annauniversityedu.blogspot.com
16
EX. NO: 06
DATE :
MOVE A DATA BLOCK WITHOUT OVERLAP
AIM:
To move a data block without overlap
APPARATUS REQUIRED:
S.NO ITEM SPECIFICATION QUANTITY
1. MICROPROCESSOR KIR 8086 KIT 1
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
➢Initialize the memory location to the datapointer.
➢Increment Bregister.
➢Increment accumulator by 1 and adjust it to decimal everytime.
➢Compare the given decimal number with accumulatorvalue.
➢When both match, the equivalent hexadecimal value is in Bregister.
➢Store the resultant in memorylocation.
Downloaded from: annauniversityedu.blogspot.com
17
PROGRAM:
ADDRESS OPCODES PROGRAM COMMENTS
1000 MOV CL, 05 Get the Data range
1002 MOV SI, 1400 Get the first data.
1005 MOV DI, 1450 Get the second data.
Store the lower order
1008 LD DSB
product
1009 MOV [DI], AL Store the result
100B INC DI Increment the pointer.
100C DEC 1008 Dec Counter 0
1010 INT 3 Stop the program
OUTPUT:
INPUT OUTPUT
1400 1450
1401 1451
1402 1452
1403 1453
1404 1454
RESULT:
Thus the output for the Move a data block without overlap was executed
successfully.
Downloaded from: annauniversityedu.blogspot.com
18
EX. NO: 07
DATE :
CODE CONVERSION-DECIMAL TO HEXADECIMAL
AIM:
To convert a given decimal number to hexadecimal.
ALGORITHM:
➢Initialize the memory location to the datapointer.
➢Increment Bregister.
➢Increment accumulator by 1 and adjust it to decimal everytime.
➢Compare the given decimal number with accumulatorvalue.
➢When both match, the equivalent hexadecimal value is in Bregister.
➢Store the resultant in memorylocation.
Downloaded from: annauniversityedu.blogspot.com
19
FLOWCHART:
Downloaded from: annauniversityedu.blogspot.com
20
PROGRAM:
ADDRESS OPCODE LABEL MNEMONICS COMMENDS
1000 MOV AL, [1100] Move data block AL
1003 MOV AH, AL Move data lower to higher
1005 MOV AH, 0F Move data OF into AH
1008 MOV BL, AH Move data BL into AH
100A AND AL,F0 AND the data AL to FO
100C MOV CL, 04 Move data 04 to CL block
100E ROR AL, CL Rotate functions CL and AL
1010 MOV BH, 0A Move data OA into BH
1012 MUL BH Multiply BH
1014 ADD AL, BL ADD the data AL And BL
1016 MOV [2000], AL Move the store data
1019 INT 3 Stop the program
OUTPUT:[DECIMAL TO HEXADECIMAL]
DATA ADRESS DATA
INPUT
OUTPUT
Downloaded from: annauniversityedu.blogspot.com
21
RESULT:
Thus the code conversion of decimal to hexadecimal was executed
successfully.
Downloaded from: annauniversityedu.blogspot.com
22
EX. NO: 08
DATE :
CODE CONVERSION –HEXADECIMAL TO DECIMAL
AIM:
To convert a given hexadecimal number to decimal
ALGORITHM:
➢ Initialize the memory location to the datapointer.
➢ Increment Bregister.
➢ Increment accumulator by 1 and adjust it to decimal everytime.
➢ Compare the given hexadecimal number with B registervalue.
➢ When both match, the equivalent decimal value is in Aregister.
➢ Store the resultant in memorylocation.
Downloaded from: annauniversityedu.blogspot.com
23
PROGRAM;
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
1000 MOV AL, [1100] Move date to AL REG
1003 MOV DX, 0000 Move data AL TO DX
1006 HUND CMP AL, 64 Move data to AX REG
1008 JC TEN Jump carry
100A SUB AL, 64 Subtract data
100C INC DL Increment DL
100E JMP HUND JUMP label data
1010 TEN CMP AL, 0A Compare register
1012 JC UNIT Jump carry
1014 SUB AL,0A Subtract data
1016 INC DH Increment DH
1018 JMP TEN JUMP carry
101A UNIT MOV [2000],DL Move data to DL
101E MOV [2001],DH Move data to DH
1022 MOV [2002],AL Move data to AL
1025 MOV [2003],AH Move data to AH
1027 HLT Stop the program
Downloaded from: annauniversityedu.blogspot.com
24
OUTPUT:
INPUT OUTPUT
MEMORY
DATA
RESULT:
Thus the code conversion of decimal to hexadecimal was executed
successfully.
Downloaded from: annauniversityedu.blogspot.com
25
EX. NO: 09
DATE :
STRING MANIPULATION - SORTING & SEARCHING
ASCENDING & DESCENDING
AIM:
To write an Assembly Language Program (ALP) to sort a given array in
Ascending and Descending order
APPARATUS REQUIRED:
S.NO ITEM SPECIFICATION QUANTITY
1. MICROPROCESSOR KIR 8086 KIT 1
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
PROBLEM STATEMENT:
An array of length 05 is given from the location. Sort it into descending and
ascending order and store the result.
Downloaded from: annauniversityedu.blogspot.com
26
ALGORITHM:
Sorting in ascending order:
➢ Load the array count in two registers C1 andC2.
➢ Get the first twonumbers.
➢ Compare the numbers and exchange if necessary so that the two numbers are in
ascendingorder.
➢ DecrementC2.
➢ Get the third number from the array and repeat the process until C 2 is0.
➢ Decrement C1 and repeat the process until C1 is0.
Sorting in descending order:
➢ Load the array count in two registers C1 andC2.
➢ Get the first twonumbers.
➢ Compare the numbers and exchange if necessary so that the two numbers are in
descendingorder.
➢ DecrementC2.
➢ Get the third number from the array and repeat the process until C 2 is0.
➢ Decrement C1 and repeat the process until C1 is0.
Downloaded from: annauniversityedu.blogspot.com
27
FLOECHART:[ASCENDING]:
Downloaded from: annauniversityedu.blogspot.com
28
FLOWCHART :[DECENDING]:
Downloaded from: annauniversityedu.blogspot.com
29
PROGRAM FOR ASCENDING ORDER:
ADDRESS LABEL PROGRAM COMMENTS
Initialize memory location for
1000 MOV SI,1200H
array size
1002 MOV CL,[SI] Number of comparisons in CL
Initialize memory location for
1004 L4 : MOVSI,1200H
array size
1005 L4 MOV DL,[SI] Get the count in DL
1007 INC SI Go to next memory location
100D L3 MOV AL,[SI] Get the first data in AL
101B L1 L3 : INC SI Go to next memory location
101E L2 MOV BL,[SI] Get the second data in BL
1010 CMP AL,BL Compare two data’s
1012 JNB L1 If AL < BL go to L1
Else, Decrement the memory
1014 DEC SI
location
1016 MOV [SI],AL Store the smallest data
1018 MOV AL,BL Get the next data AL
1019 JMP L2 Jump to L2
101A L1 : DEC SI Decrement the memory location
Store the greatest data in memory
101C MOV [SI],BL
location
101E L2 : INC SI Go to next memory location
1020 DEC DL Decrement the count
Jump to L3, if the count is not
1022 JNZ L3
reached
1024 MOV [SI],AL Store data in memory location
1026 DEC CL Decrement the count
Jump to L4, if the count is not
1028 JNZ L4
reached zero
1029 HLT Stop the program
Downloaded from: annauniversityedu.blogspot.com
30
PROGRAM FOR DESCENDING ORDER:
ADDRESS OPCODES PROGRAM COMMENTS
Initialize memory location
9000 MOV SI,9000H
for array size
Number of comparisons in
9002 MOV CL,[SI]
CL
L4 : MOV Initialize memory location
9004
SI,9000H for array size
9006 MOV DL,[SI] Get the count in DL
Go to next memory
9007 INC SI
location
9009 MOV AL,[SI] Get the first data in AL
Go to next memory
900B L3 : INC SI
location
Move the data SI reg into
900D MOV BL,[SI]
BL reg
Compare BC and AL
900F CMP AL,BC
register
9010 JB 101B Jump given address
9012 DEC SI Decrement SI
Move the data AL register
9014 MOV [SI],AL
into SI register
9016 MOV AL,BL Move the data AL into BL
9018 JMP 101E Jump given address
Downloaded from: annauniversityedu.blogspot.com
31
901A DEC SI Decrement SI
Move the data AL into SI
901C MOV [SI],AL
register
901E INC SI Increment SI
9020 DEC SI Decrement SI
9022 JNZ 1000 Jump no zero
9024 MOV [SI],AL Move AL into SI register
9026 DEC CL Decrement CL
9028 JNZ 1005 Jump no zero 1005
902A INT 3 Stop theprogram
Downloaded from: annauniversityedu.blogspot.com
32
OUTPUT FOR ASCENDING:
DATA
INPUT
OUTPUT
OUTPUT FOR DESCENDING ORDER:
DATA
INPUT
OUTPUT
RESULT:
Thus the given array of numbers are sorted in ascending & descendingorder.
Downloaded from: annauniversityedu.blogspot.com
33
EX. NO: 10
DATE :
LARGEST & SMALLEST
AIM:
To write an Assembly Language Program(ALP) to find the Largest and
Smallest number in a given array.
APPARATUS REQUIRED:
S.NO ITEM SPECIFICATION QUANTITY
1. MICROPROCESSOR KIR 8086 KIT 1
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
PROBLEM STATEMENT:
An array of length 5 is given from the location. Find the largest and smallest
number and store the result.
Downloaded from: annauniversityedu.blogspot.com
34
ALGORITHM:
(i) Finding largestnumber:
➢ Load the array count in a registerC1.
➢ Get the first twonumbers.
➢ Compare the numbers and exchange if the number issmall.
➢ Get the third number from the array and repeat the process until C1 is0.
(ii) Finding smallestnumber:
➢ Load the array count in a registerC1.
➢ Get the first twonumbers.
➢ Compare the numbers and exchange if the number islarge.
➢ Get the third number from the array and repeat the process until C1 is0.
Downloaded from: annauniversityedu.blogspot.com
35
FLOECHART:[LARGEST]
Downloaded from: annauniversityedu.blogspot.com
36
FLOECHART:[SMALLEST]
Downloaded from: annauniversityedu.blogspot.com
37
PROGRAM FOR FINDING LARGEST NUMBER:
ADDRESS OPCODES PROGRAM COMMENDS
1000 MOV SI,9000H Initialize array size
1002 MOV CL,[SI] Initialize the count
1004 INC SI Go to next memory location
1006 MOV AL,[SI] Move the first data in AL
1007 DEC CL Reduce the count
1009 INC SI Move the SI pointer to next data
100A L2 CMP AL,[SI] Compare two data’s
100E JNB L1 If AL > [SI] then go to L1 ( no swap)
1011 L1 MOV AL,[SI] Else move the large number to AL
1012 L1 : DEC CL Decrement the count
1014 JNZ L2 If count is not zero go to L2
1016 MOV DI,9500H Initialize DI with 1300H
Else store the biggest number in 1300
1018 MOV [DI],AL
location
1010 HLT Stop the program
Downloaded from: annauniversityedu.blogspot.com
38
PROGRAM FOR FINDING SMALLEST NUMBER:
ADDRESS OPCODES PROGRAM COMMENDS
1000 MOV SI,9000H Initialize array size
1002 MOV CL,[SI] Initialize the count
1004 INC SI Go to next memory location
1006 MOV AL,[SI] Move the first data in AL
1007 DEC CL Reduce the count
1009 L2 : INC SI Move the SI pointer to next data
100A L2 CMP AL,[SI] Compare two data’s
100E JB L1 If AL < [SI] then go to L1 ( no swap)
1011 L1 MOV AL,[SI] Else move the large number to AL
1012 L1 : DEC CL Decrement the count
1014 JNZ L2 If count is not zero go to L2
1016 MOV DI,9500H Initialize DI with 1300H
1018 MOV [DI],AL Else store the biggest number in 1300 location
1010 HLT Stop the program
Downloaded from: annauniversityedu.blogspot.com
39
OUTPUT FOR LARGESTNUMBER:
DATA
INPUT
OUTPUT
OUTPUT FOR SMALLEST NUMBER:
DATA
INPUT
OUTPUT
RESULT:
Thus the largest and smallest number is found in a given array.
Downloaded from: annauniversityedu.blogspot.com
40
EX. NO: 11
DATE :
PASSWORD CHECKING
AIM:
To write an Assembly Language Program (ALP) for performing the
Password checking by using MASM
APPARATUS REQUIRED:
SL .No ITEM SPECIFICATION QUANTITY
1. Microprocessor kit 8086 kit 1
2. Power Supply +5 V dc 1
PROGRAM:
; PASSWORD ISMASM1234
DATA SEGMENT
PASSWORD DB'MASM1234'
LEN EQU ($-PASSWORD)
MSG1 DB 10, 13,'ENTER YOUR PASSWORD: $'
MSG2DB10,13,'WELCOMETOELECTRONICSWORLD!!$' MSG3
DB 10, 13,'INCORRECTPASSWORD!$'
NEW DB 10, 13,'$'
INST DB 10 DUP(0)
DATA ENDS
CODE SEGMENT
Downloaded from: annauniversityedu.blogspot.com
41
ASSUME CS: CODE, DS:DATA
START:
MOV AX, DATA
MOV DS, AX
LEA DX, MSG1
MOV AH, 09H
INT 21H
MOV SI, 00
UP1:
MOV AH,08H
INT21H
CMP AL,0DH
JEDOWN
MOV [INST+SI],AL
MOV DL,'*'
MOV AH, 02H
INT 21H
INC SI
JMPUP1
DOWN:
MOV BX, 00
MOV CX,LEN
CHECK:
MOV AL,[INST+BX]
MOVDL,[PASSWORD+BX]
CMP AL, DL
JNE FAIL
Downloaded from: annauniversityedu.blogspot.com
42
INC BX
LOOPCHECK
LEA DX, MSG2
MOV AH, 09H
INT 21H
JMP FINISH
FAIL:
LEA DX, MSG3
MOV AH, 009H
INT 21H
FINISH:
INT 3
CODEENDS
ENDSTART
END
RESULT:
Thus the output for the Password checking, Print RAM size and system date
was executed successfully
Downloaded from: annauniversityedu.blogspot.com
43
EXP.NO: 12
DATE :
TRAFFIC LIGHT CONTROLLER
AIM:
To write an assembly language program in 8086 to Traffic light control
APPARATUS REQUIRED:
SL .No ITEM SPECIFICATION QUANTITY
1. Microprocessor kit 8086 kit 1
2. Power Supply +5 V dc 1
PROGRAM;
➢ Log intoSystem.
➢ Select controltype.
➢ If Automatic mode select then go to step 4th else go to step8.
➢ If Automatic controlactivated.
➢ Assign time period for green, yellowsignal.
➢ If emergency vehicle is over then go to step4.
➢ If rally come then go to step8.
➢ Manual control activated.
➢ Assign time period for green, yellow signal according to that particularroad.
➢ If emergency over then go to step4.
Downloaded from: annauniversityedu.blogspot.com
44
MODEL GRAPH FOR TRAFFIC LIGHT CONTROL:
Downloaded from: annauniversityedu.blogspot.com
45
ASSEMBLY LANGUAGE PROGRAM FOR TRAFFIC LIGHT CONTROL:
ADDRESS
OPCODE LABEL MNEMONICS
1000 MVI A,80
1002 OUT CWR
1004 REPEAT MVI E, 03
1006 LXI H, C100
1007 NEXTSTAT MOV A, M
1009 OUT PORRTA
100B INX H
100E MOV A, M
1010 OUT PORTB
1012 INX H
1014 MOV A,M
1016 OUT PORT C
1018 CALL DELAY
1019 INX H
101A DCR E
101C JNZ NEXTSTAT
101E JMP REPEAT
1022 DELAY LXI D, 3000
1024 L2 MVI C,FF
1026 L1 DCR C
1028 JNZ L1
1029 DCR D
1000 MOV A, D
1002 ORA E
1004 JNZ L2
1006 RET
▪
Downloaded from: annauniversityedu.blogspot.com
46
RESULT:
Thus the assembly language program for traffic light control is verified
Downloaded from: annauniversityedu.blogspot.com
47
EX. NO: 13
DATE :
STEPPER MOTOR INTERFACING
AIM:
To write an assembly language program in 8086 to rotate the motor at
different speeds.
APPARATUS REQUIRED:
SL.NO ITEM SPECIFICATION QUANTITY
1. Microprocessor kit 8086 1
2. Power Supply +5 V, dc,+12 V dc 1
3. Stepper Motor Interface board - 1
4. Stepper Motor - 1
PROBLEM STATEMENT:
Write a code for achieving a specific angle of rotation in a given time and
particular number of rotations in a specific time.
THEORY:
A motor in which the rotor is able to assume only discrete stationary
angular position is a stepper motor. The rotary motion occurs in a stepwise manner
from one equilibrium position to the next. Two-phase scheme: Any two adjacent
stator windings are energized. There are two magnetic fields active in quadrature
and none of the rotor pole faces can be in direct alignment with the stator poles. A
partial but symmetric alignment of the rotor poles is of coursepossible.
Downloaded from: annauniversityedu.blogspot.com
48
ALGORITHM:
For running stepper motor clockwise and anticlockwise directions
➢ Get the first data from the lookuptable.
➢ Initialize the counter and move data intoaccumulator.
➢ Drive the stepper motor circuitry and introducedelay
➢ Decrement the counter is not zero repeat fromstep(iii)
➢ Repeat the above procedure both for backward and forwarddirections.
SWITCHING SEQUENCE OF STEPPER MOTOR:
MEMORY A1 A2 B1 B2 HEX CODE
LOCATION
4500 1 0 0 0 09 H
4501 0 1 0 1 05 H
4502 0 1 1 0 06 H
4503 1 0 1 0 0A H
Downloaded from: annauniversityedu.blogspot.com
49
FLOWCHART:
Downloaded from: annauniversityedu.blogspot.com
50
PROGRAM FOR STEPPER MOTOR CONTOL;
ADDRESS OPCODE PROGRAM COMMENTS
Initialize memory location to store the
1000 MOV DX,FF26
array of number
1002 MOV AL,80 Initialize array size
1004 OUT DX,AL Copy the first data in AL
1006 MOV DX,FF20 Send it through port address
1007 MOV AL,05 Introduce delay
1009 OUT DX,AL Declare DX
100B CALL 1100 JUNP no zero
100E MOV AL,07 Increment DI
1010 OUT DX,AL Go to next memory location
Loop until all the data’s have been sent
1012 CALL 1100 Go to start location for continuous
rotation
1014 MOV AL,06 Array of data’s
1015 OUT DX,AL Output data from DX into AL
1017 CALL 1100 Call given address
1018 MOV AL,04 Move the data 04 to AL Register
101D OUT DX,AL Output data from DX into AL
101E CALL 1100 Call given address
1021 JMP 1006 Jump the program given address
Downloaded from: annauniversityedu.blogspot.com
51
DELAY SUBROTINE
ADDRESS OPCODE PROGRAM COMMENTS
Initialize memory location to store the
1100 MOVBX, 0010
array of number
1103 MOV AL,FF Initialize array size
1105 NOP No Operation
1106 NOP No Operation
1107 NOP No Operation
1108 NOP No Operation
1109 DEC AL Decrement AL
110B JNZ 1105 Jump no zero
110D DEC BX Decrement BX
110E JNZ 1103 Jump no zero
1110 RET Return main program
RESULT:
Thus the assembly language program for rotating stepper motor in both
clockwise and anticlockwise directions is written and verified.
Downloaded from: annauniversityedu.blogspot.com
52
EX. NO: 14
DATE :
INTERFACING PRGRAMMABLE KEYBOARD
ANDDISPLAY CONTROLLER 8279
AIM :
To display the message “2” using Keyboard and Display Controller-8279
APPARATUS REQUIRED:
SL.NO ITEM SPECIFICATION QUANTITY
1. Microprocessor kit 8086 1
2. Power Supply +5 V, dc,+12 V dc 1
3. 8279- Interface board - 1
ALGORITHM :
➢ Display of rolling message “HELP US“
➢ Initialize thecounter
➢ Set 8279 for 8 digit character display, rightentry
➢ Set 8279 for clearing thedisplay
➢ Write the command todisplay
➢ Load the character into accumulator and displayit
➢ Introduce thedelay
➢ Repeat from step1.
Downloaded from: annauniversityedu.blogspot.com
53
PROGRAM:
MEMORY
OPCODES PROGRAM COMMENDS
LOCATION
9000 MVI C,BA Initialize array
9002 MVI A,12 Initialize array size
Store the control word for
9003 OUT 71
display mode
9006 MVI A,3E Send through output port
Store the control word to
9009 OUT 71
clear display
900B MVI A,A0 Send through output port
Store the control word to
900E OUT 71
write display
9011 MVI B,08 Send through output port
9013 MVI A,00 Get the first data
9016 OUT 70 Send through output port
9018 DCR B Give delay
901B JNZ 9012 Go & get next data
Loop until all the data’s
901D MOV A,C
have been taken
901E OUT 70 Go to starting location
901F JMP 9019 Store 16bit count value
Downloaded from: annauniversityedu.blogspot.com
54
FLOWCHART:
Downloaded from: annauniversityedu.blogspot.com
55
SEGMENT DEFINITION:
DATA BUS D7 D6 D5 D4 D3 D2 D1 D0
SEGMENTS d c B A d g f e
RESULT:
Thus the rolling message “2” is displayed using 8279 interface kit.
Downloaded from: annauniversityedu.blogspot.com
56
EX. NO: 15
DATE :
INTERFACING ANALOG TO DIGITAL CONVERTER USING 8086
AIM:
To write an assembly language program to convert analog signal into digital
signal using an ADC interfacing.
APPARATUS REQUIRED:
SL.NO ITEM SPECIFICATION QUANTITY
1. Microprocessor kit 8086 1
2. Power Supply +5 V dc,+12 V dc 1
3. ADC Interface board - 1
THEORY:
An ADC usually has two additional control lines: the SOC input to tell the
ADC when to start the conversion and the EOC output to announce when the
conversion iscomplete.
ALGORITHM:
➢ Select the channel and latch theaddress.
➢ Send the start conversionpulse.
➢ Read EOC signal.
➢ If EOC = 1 continue else go to step(iii)
➢ Read the digitaloutput.
➢ Store it in a memorylocation.
Downloaded from: annauniversityedu.blogspot.com
57
PROGRAM:
MEMORY
OPCODES PROGRAM COMMENTS
LOCATION
Load accumulator
1000 MOV DX,FF26 with value for ALE
high
Send through output
1000 MOV AL,90
port
Load accumulator
1003 OUT DX,AL with value for ALE
low
Send through output
1006 MOV DX,FF24
port
Store the value to
1009 MOV AL,FF make SOC high in
the accumulator
Send through output
100B OUT DX,AL
port
100E MOV AL,00
1011 OUT DX,AL
Introduce delay
1013 MOV AL,FF
1016 OUT DX,AL
Store the value to
1018 CALL 1100 make SOC low the
accumulator
Send through output
101B MOV DX,FF20
port
IN AL,DX Read the EOCsignal
101D from port & check
for end ofconversion
101E INT 3
Stop the program
Downloaded from: annauniversityedu.blogspot.com
58
DELAY SUBROUTINE PROGRAM
Move the data 07ff to
2100 MOV CX,07FF
CX register
2103 NOP No operation
2104 NOP No operation
2105 DEC CX Decrement CX register
2106 JNZ 1103 Jump no zero
2108 RET Return to main address
Downloaded from: annauniversityedu.blogspot.com
59
FLOWCHART:
Downloaded from: annauniversityedu.blogspot.com
60
OUTPUT:
HEX CODE IN MEMORY DIGITAL DATA ON LED
ANALOG VOLTAGE
LOCATION DISPLAY
RESULT:
Thus the ADC was interfaced with 8086 and the given analog inputs were
converted into its digital equivalent.
Downloaded from: annauniversityedu.blogspot.com
61
EX. NO: 16
DATE :
INTERFACING DIGITAL – TO – ANALOG
CONVERTERUSING 8086
AIM:
To convert digital inputs into analog outputs and to generate different
waveforms.
APPARATUS REQUIRED:
SL.NO ITEM SPECIFICATION QUANTITY
1. Microprocessor kit 8086 Vi Microsystems 1
2. Power Supply +5 V, dc,+12 V dc 1
3. DAC Interface board - 1
PROBLEM STATEMENT:
The program is executed for various digital values and equivalent analog
voltages are measured and also the waveforms are measured at the output ports
usingCRO.
THEORY:
Since DAC 0800 is an 8 bit DAC and the output voltage variation is
between –5v and +5v. The output voltage varies in steps of 10/256 = 0.04
(approximately). The digital data input and the corresponding output voltages are
presented in the table. The basic idea behind the generation of waveforms is the
continuous generation of analog output of DAC. With 00 (Hex) as input to DAC2
the analog output is –5v. Similarly with FF H as input, the output is +5v.
Outputting digital data 00 and FF at regular intervals, to DAC2, results in a square
wave of amplitude 5v.Output digital data from 00 to FF in constant steps of 01 to
DAC2. Repeat this sequence again and again. As a result a saw-tooth wave will be
generated at DAC2 output. Output digital data from 00 to FF in constant steps of
01 to DAC2. Output digital data from FF to 00 in constant steps of01 to DAC2.
Downloaded from: annauniversityedu.blogspot.com
62
FLOECHART
Downloaded from: annauniversityedu.blogspot.com
63
ALGORITHM
Measurement of analog voltage
(i) Send the digital value ofDAC.
(ii) Read the corresponding analog value of itsoutput.
Waveform generation
Square Waveform:
(i) Send low value (00) to theDAC.
(ii) Introduce suitabledelay.
(iii) Send high value toDAC.
(iv) Introducedelay.
(v) Repeat the above
procedure. Saw-toothwaveform:
(i) Load low value (00) toaccumulator.
(ii) Send this value toDAC.
(iii) Increment theaccumulator.
(iv) Repeat step (ii) and (iii) until accumulator value reachesFF.
(v) Repeat the above procedure from step 1.
Triangularwaveform:
(i) Load the low value (00) inaccumulator.
(ii) Send this accumulator content toDAC.
(iii) Increment theaccumulator.
(iv) Repeat step 2 and 3 until the accumulator reaches FF,
decrement the accumulator and send the accumulator contents
toDAC.
MEASUREMENT OF ANALOG VOLTAGE
DIGITAL DATA ANALOG VOLTAGE
Downloaded from: annauniversityedu.blogspot.com
64
PROGRAME FOR DAC
MEMORY
OPCODES PROGRAM COMMENTS
LOCATION
Load accumulator
1000 MOV DX,FF26 with value for ALE
high
Send through output
1000 MOV AL,80
port
Load accumulator
1003 OUT DX,AL with value for ALE
low
Send through output
1006 MOV DX,FF22
port
Store the value to
1009 MOV AL,FF make SOC high in
the accumulator
Send through output
100B OUT DX,AL
port
100E CALL 2100
1011 MOV AL,00
Introduce delay
1013 OUT DX,AL
1016 CALL 2100
Store the value to
1018 JMP 2009 make SOC low the
accumulator
Downloaded from: annauniversityedu.blogspot.com
65
DELAY SUOUTINEBR
Move the data 07ff to
2100 MOV CX,07FF
CX register
2103 NOP No operation
2104 NOP No operation
Decrement CX
2105 DEC CX
register
2106 JNZ 2103 Jump no zero
Return to main
2108 RET
address
RESULT
Thus the DAC was interfaced with 8086 and different waveforms have been
generated.
Downloaded from: annauniversityedu.blogspot.com
66
EX. NO: 17
DATE :
8 BIT ADDITION USING ARITHMETIC OPERATION 8051
MICROCONTROLLER
AIM:
To write an ALP program to add two 8-bit numbers using 8051
microcontroller.
ALGORITHM:
➢Clear Program StatusWord.
➢Select Register bank by giving proper values to RS1 & RS0 ofPSW.
➢Load accumulator A with any desired 8-bitdata.
➢Load the register R 0 with the second 8- bitdata.
➢Add these two 8-bitnumbers.
➢Store the result.
➢Stop theprogram.
Downloaded from: annauniversityedu.blogspot.com
67
FLOW CHART
Downloaded from: annauniversityedu.blogspot.com
68
PROGRAM
ADDRESS OPCODE MNEMONIC COMMENTS
MOV DPTR,#8300H Get the data1 in
8100
Accumulator
8101 Add the data1 with
MOV X A,@DPTR data2
8103 MOV B,A
Move the data A
into B
8105 INCDPTR
Initialize the
memory Location
8108 MOV X A,@DPTR
Move the data
DPTR into A
8109 ADD A,B Add A and B
8110 INC X @DPTR,A Increment data
Move the data A
8111 MOV X @DPTR,A
into B
8112 LJMP 0000 Stop the program
OUTPUT:
INPUT OUTPUT
MEMORY MEMORY
DATA DATA
RESULT:
Thus the 8051 ALP for addition of two 8 bit numbers is executed.
Downloaded from: annauniversityedu.blogspot.com
69
EX. NO: 18
DATE :
8 BIT SUBTRACTION USING ARITHMETIC OPERATION
8051 MICROCONTROLLER
AIM:
To perform subtraction of two 8 bit data and store the result in memory.
ALGORITHM:
➢ Clear the carryflag.
➢ Initialize the register forborrow.
➢ Get the first operand into theaccumulator.
➢ Subtract the second operand from theaccumulator.
➢ If a borrow results increment the carryregister.
➢ Store the result inmemory.
Downloaded from: annauniversityedu.blogspot.com
70
FLOECHART:
Downloaded from: annauniversityedu.blogspot.com
71
8 BIT SUBTRACTION
ADDRESS OPCODE MNEMONIC COMMENTS
MOV DPTR,#8300H Get the data1 in
8100
Accumulator
8101 MOV X A,@DPTR
Add the data1
with data2
8103 MOV B,A
Move the data A
into B
8105 INCDPTR
Initialize the
memory Location
8108 MOV X A,@DPTR
Move the data
DPTR into A
8109 SUB B A,B Sub A and B
8110 INC X @DPTR,A Increment data
Move the data A
8111 MOV X @DPTR,A
into B
8112 LJMP 0000 Stop the program
OUTPUT:
INPUT OUTPUT
Memory Memory
Data Data
RESULT:
Thus the 8051 ALP for subtraction of two 8 bit numbers is executed .
Downloaded from: annauniversityedu.blogspot.com
72
EX. NO: 19
DATE :
8 BIT MULTIPLICATION USING ARITHMETION OPERATION 8051
MICROCONTROLLER
AIM:
To perform multiplication of two 8 bit data and store the result in memory.
ALGORITHM:
➢ Get the multiplier in theaccumulator.
➢ Get the multiplicand in the Bregister.
➢ Multiply A withB.
➢ Store the product in memory.
Downloaded from: annauniversityedu.blogspot.com
73
FLOWCHART:
Downloaded from: annauniversityedu.blogspot.com
74
8 BIT MULTIPLICATION
ADDRESS OPCODE MNEMONIC COMMENTS
MOV DPTR,#8300H Get the data1 in
8100
Accumulator
8101 MOV X A,@DPTR Add the data1
with data2
8103 MOV B,A Move the data A
into B
8105 INC DPTR Initialize the
memory Location
8108 MOV X A,@DPTR Move the data
DPTR into A
8109 ADD A,B Sub A and B
8110 INC DPTR Increment data
Move the data A
8111 MOV X @DPTR,A
into B
8112 SJMP 0000 Stop the program
Downloaded from: annauniversityedu.blogspot.com
75
OUTPUT:
INPUT OUTPUT
Memory Memory
Data Data
Location location
4500 4502
4501 4503
RESULT:
Thus the 8051 ALP for multiplication of two 8 bit numbers is executed .
Downloaded from: annauniversityedu.blogspot.com
76
EX. NO: 20
DATE :
8 BIT DIVISION USING ARITHMETIC OPERATION 8051
MICROCONTROLLER
AIM:
To perform division of two 8 bit data and store the result in memory
ALGORITHM:
➢ Get the Dividend in theaccumulator.
➢ Get the Divisor in the Bregister.
➢ Divide A byB.
➢ Store the Quotient and Remainder inmemory.
Downloaded from: annauniversityedu.blogspot.com
77
FLOWCHART:
Downloaded from: annauniversityedu.blogspot.com
78
8 BIT DIVISION
ADDRESS OPCODE MNEMONIC COMMENTS
MOV DPTR,#8300H Get the data1 in
8100
Accumulator
8101 MOV X A,@DPTR Add the data1
with data2
8103 Move the data A
MOV B,A into B
8105 Initialize the
INC DPTR memory Location
8108 Move the data
MOV X A,@DPTR DPTR into A
8109 DIV A,B Div A and B
8110 INC DPTR Increment data
Move the data A
8111 MOV X @DPTR,A
into B
8112 SJMP 0000 Stop the program
Downloaded from: annauniversityedu.blogspot.com
79
OUTPUT:
INPUT OUTPUT
Memory Memory
Data Data
Location location
4500 4502
4501 4503
RESULT:
Thus the 8051 ALP for division of two 8 bit numbers is executed.
Downloaded from: annauniversityedu.blogspot.com
80
EX. NO: 21
DATE :
LOGICAL OPERATIONS
USING8051
MICROCONTROLLER
AIM:
To perform logical operation using 8051 microcontroller AND, OR & EX-OR.
ALGORITHM:
➢ Get the input value and store data in theaccumulator.
➢ Get the second values and store the Bregister.
➢ Logical operation to perform the givennumber
➢ Store the output value inmemory.
Downloaded from: annauniversityedu.blogspot.com
81
PROGRAM FOR “AND” LOGIC
ADDRESS OPCODE LABEL MNEMONICS COMMENT
8000 MOV DPTR,#9000h Move DPTR to 9000 Address
8003 MOVX A,@DPTR Move XA register to DPTR
8007 ANL A,#20 AND Operation
800D INC DPTR Increment DPTR
Move DPTR register to
800B MOV X @DPTR,A accumulator
8010 SJMP 8008 Copy the lower order data
PROGRAM FOR “OR” LOGIC
ADDRESS OPCODE LABEL MNEMONICS COMMENT
8000 MOV DPTR,#9000 Move DPTR to 9000 Address
8003 MOVX A,@DPTR Move XA register to DPTR
8007 ORL A,#20 OR Operation
800D INC DPTR Increment DPTR
Move DPTR register to
800B MOV X @DPTR,A accumulator
8010 SJMP 8008 Copy the lower order data
Downloaded from: annauniversityedu.blogspot.com
82
PROGRAM FOR “EX- OR” LOGIC
ADDRESS OPCODE LABEL MNEMONICS COMMENT
8000 MOV DPTR,#9000 Move DPTR to 9000 Address
8003 MOVX A,@DPTR Move XA register to DPTR
8007 XRL A,#50 EX-OR Operation
800D INC DPTR Increment DPTR
Move DPTR register to
800B MOV X @DPTR,A
accumulator
8010 SJMP 8008 Copy the lower order data
OUTPUT:
GATE INPUT OUTPUT
AND
OR
EX-OR
RESULT:
Thus the assembly language program to perform logical operations AND, OR
& EX-OR using 8051 Performed and the result is stored.
Downloaded from: annauniversityedu.blogspot.com
83
EX. NO: 22
DATE :
FIND 2’S COMPLEMENT OF A NUMBER
AIM:
To Finding 2’s complement of a number using 8051 micro controller
RESOURCES REQUIERED:
➢ 8051 microcontrollerkit
➢ Keyboard
➢ Powersupply
Downloaded from: annauniversityedu.blogspot.com
84
PROGRAM:
ADDRESS OPCODE LABEL MNEMONICS COMMENT
Get the first data in AX
9000 MOV DPRT,#9000
register,
Move the second data in DX
9003 MOVX A,@DPTR
register.
Compliment the higher order
9007 CPL A
data.
900D ADD A,#01 Move ax register into address
900B INC DPTR Inc DPTR
9010 MOVX @DPTR,A Copy the lower order data
9012 LJMP Store the higher order data.
OUTPUT:
INPUT DATA OUTPUT DATA
RESULT;
Thus the program of finding 2’s complement of a number is done in 8051
microcontroller
Downloaded from: annauniversityedu.blogspot.com
85
EX. NO: 23
DATE :
COVERSION OF BCD TO ASCII
AIM:
To convert BCD number into ASCII by using 8051 micro controller
RESOURCES REQUIERED:
➢ 8051 microcontrollerkit
➢ Keyboard
➢ Powersupply
ALGORITHM:
59 AAM
00 08 09
AH AL AH AL
NOTE;59H TO 89 DECIMAL
ADD
08 09 38 39
AX,3030
H
AH AL AH AL
NOTE; 38h and 39h are the ASCII equivalents of 8 and 9 respectively
➢ Save contents of all registers which are used in theroutine
➢ Get the data in al register and make AH equal to00.
➢ Use AAM instruction to convert number in its decimal equivalent in the
unpackedformat.
➢ Add 30h in each digit to get its ASCIIequivalent.
➢ Display one by one using function 2 of INT21h.
➢ Routine content ofregister.
Downloaded from: annauniversityedu.blogspot.com
86
FLOWCHART:
Downloaded from: annauniversityedu.blogspot.com
87
PROGRAM;
ROUTINE: convert binary for number less than 100 passing parameter
; Hex number in al register.
; Routine to convert binary number into its
; Decimal and then ASCII equivalent, and display the number
BTA PROC NEAR
PUSHDX
PUSHBX
PUSHAX
MOV AX, 00H
AAM
ADD AX,3030H
MOV BX, AX
MOVDL, BH
MOV AH, 02
INT21H
MOV DL, BL
INT 21H
POPAX
POPBX
POPDX
RET
ENDP
Downloaded from: annauniversityedu.blogspot.com
88
RESULT:
Thus the given number is BCD number converted into ASCII using 8051
microcontroller kit.
Downloaded from: annauniversityedu.blogspot.com
89
IMPORTANT VIVA QUESTIONS FOR ANNA UNIVERSITY PRACTICALS
1. What is a microprocessor ?
2. Tell Something about Bit, Byte and Word.
3. Mention the different functional units in 8086.
4. What is the function of BIU?
5. What are the main functional units in 8086 ?
6. What is the function of EU ?
7. What is the maximum size of segment in 8086 Microprocessor ?
8. What are the four general purpose registers in 8086 ?
9. What is the special purpose register?
10. What are the functions of base registers?
11. Name the pin in 8086 microprocessor that is used for the selecting mode of operation.
12. What is a Segment address in 8086?
13. What are the flags in 8086?
14. What is Tri-state logic?
15. What is system bus?
16. What is the difference between Maskable and Non-Maskable Interrupts?
17. What are the different types of Addressing Modes?
18. Mention something about Baud Rate?
19. What is Port?
20. What is 8255?
21. What is the size of instruction queue in 8086?
22. What is meant by pipelining in 8086?
23. How many 16 bit registers are available in 8086?
24. What is meant by assembly directives?
25. What is the relationship between 8086 processor frequency and crystal frequency?
Downloaded from: annauniversityedu.blogspot.com
90
26. What is the supply requirement of 8086?
27. What are the functions of Accumulator?
28. What are the roles of AX,BX,CX,DX registers?
29. How physical address is generated?
30. What are the pointers present in 8086 ?
31. What were the operations not available in 8085 but available in 8086?
32. What is the difference between Min Mode and Max Mode of 8086?
33. Which interrupts are generally used for critical events?
34. What is the Maximum clock frequency in 8086?
35. Which Stack is used in 8086?
36. What are the address lines for the software interrupts?
37. What is meant by SIM and RIM instruction?
38. What shall be the position of the Stack Pointer after the PUSH instruction is used?
39. What shall be the position of the Stack Pointer after the POP instruction is used?
40. Which type of registers in 8086 are responsible for performing logical operations?
41. What are the examples for Microcontroller?
42. What are the address lines for the hardware interrupts?
43. Which Flags can be set or reset by the programmer and also used to control the operation
of the processor?
44. What does EU do?
45. Which microprocessor accepts the program written for 8086 without any changes?
46. What is meant by cross-compiler?
47. Which is the tool used to connect the user and the computer?
48. What do you mean by the term‘state’ in 8031/8051 microcontroller?
49. How many machine cycles are needed to execute an instruction in 8031/8051 controller?
50. How to estimate the time taken to execute an instruction in 8031/8051 controller?
51. What is the size of 8031/8051 instructions?
52. List the various machine cycles of 8031/8051 controller.
Downloaded from: annauniversityedu.blogspot.com
91
53. How the 8051 microcontroller differentiates external program memory access and data
memory access?
54. What are the addressing modes available in 8051 Controller?
55. Explain the register indirect addressing in 8051.
56. Explain the relative addressing in 8051
57. How the 8051 instructions can be classified?
58. List the instructions of 8051 that affect all the flags of 8051.
59. List the instructions of 8051 that affect overflow flag in 8051.
60. List the instructions of 8051 that affect only carry flag.
61. List the instructions of 8051 that always clear carry flag.
62. What are the operations performed by Boolean variable instructions of 8051?
63. Give some examples for 8 / 16 / 32 bit Microprocessor?
64. What do you mean by 1st / 2nd / 3rd / 4th generation processor?
65. What is the difference between microprocessor and microcontroller?
66. What is meant by the term ‘LATCH’?
67. What are the differences between primary & secondary storage device?
68. Classify static and dynamic RAM?
69. What is meant by the cache memory?
70. What is meant by the flag?
71. Name the flags used in 8086.
72. What is meant by the term’ Stack’?
73. What is the position of the Stack Pointer after the PUSH instruction?
74. What is the position of the Stack Pointer after the POP instruction?
75. What is NV-RAM?
76. Can a Processor structure be pipelined? Justify your answer.
Downloaded from: annauniversityedu.blogspot.com