Lab Record: Government College of Engineering Sengipatti, Thanjavur
Lab Record: Government College of Engineering Sengipatti, Thanjavur
Sengipatti, Thanjavur
DEPARMENT OF ELECTRONICS AND COMMUNICATION
ENGINEERING
LAB RECORD
Regulation : 2017
Regulation 2017
EC8681- MICROPROCESSOR AND MICROCONTROLLER LABORATORY
SYLLABUS
LIST OF EXPERIMENTS
TOTAL: 60 PERIODS
INTRODUCTION TO MICROPROCESSORS & MICROCONTROLLERS
Exp. Page
Date Name of the Experiment No. Marks Signature
No
16 Bit Addition Using Arithmetic
1 Operation
of 8086 Microprocessor
16 Bit Subtraction Using Arithmetic
2
Operation of 8086 Microprocessor
16 Bit Multiplication Using Arithmetic
3
Operation of 8086 Microprocessor
16 Bit Division Using Arithmetic Operation
4
of 8086 Microprocessor
Logical Operations Using 8086
5
Microprocessor
AIM:
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
16- bit addition
ADDRESS DATA
INPUT 5200
5201
5202
5203
5204
OUTPUT 5205
5206
RESULT:
Thus the assembly language program to perform addition of two 16 bit
numbers using 8086 Performed and the result is stored.
MICROPROCESSOR AND MICROCONTROLLER 4
LABORATORY
Ex. NO: 02
DATE:
16 BIT ARITHMETIC OPERATION (SUBTRACTION )
USING 8086 MICROPROCESSOR
AIM:
APPARATUS REQUIRED:
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
SUBTRACTION:
PROGRAM FOR SUBTRACTION:
ADDRESS DATA
5300
5301
INPUT
5302
5303
5304
OUTPUT 5305
5306
RESULT:
AIM:
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
16- bit MULTIPLICATION
MULTIPLICATION:
PROGRAM FOR MULTIPLICATION:
INPUT
OUTPUT
RESULT:
AIM:
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
DIVISION:
PROGRAM FOR DIVISION:
ADDRESS DATA
5200
5201
INPUT
5202
5203
5208
OUTPUT
5209
RESULT:
Thus the assembly language program to perform division of two 16 bit
numbers using 8086 Performed and the result is stored.
EX. NO: 05
DATE :
LOGICAL OPERATIONS USING 8086 MICROPROCESSOR
AIM:
APPARATUS REQUIRED:
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
➢Increment B register.
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.
EX. NO: 06
DATE :
MOVE A DATA BLOCK WITHOUT OVERLAP
AIM:
APPARATUS REQUIRED:
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
➢Increment B register.
OUTPUT:
INPUT OUTPUT
5400 5450
5401 5451
5402 5452
5403 5453
5404 5454
RESULT:
Thus the output for the Move a data block without overlap was executed
successfully.
EX. NO: 07
DATE :
CODE CONVERSION-DECIMAL TO HEXADECIMAL
AIM:
ALGORITHM:
➢Initialize the memory location to the data pointer.
➢Increment B register.
➢Increment accumulator by 1 and adjust it to decimal every time.
➢Compare the given decimal number with accumulator value.
➢When both match, the equivalent hexadecimal value is in B register.
➢Store the resultant in memory location.
FLOWCHART:
MICROPROCESSOR AND MICROCONTROLLER 20
LABORATORY
PROGRAM:
OUTPUT:[DECIMAL TO HEXADECIMAL]
INPUT
OUTPUT
AIM:
ALGORITHM:
➢ Initialize the memory location to the data pointer.
➢ Increment B register.
➢ Increment accumulator by 1 and adjust it to decimal every time.
➢ Compare the given hexadecimal number with B register value.
➢ When both match, the equivalent decimal value is in A register.
➢ Store the resultant in memory location.
PROGRAM;
INPUT OUTPUT
MEMORY
DATA
RESULT:
APPARATUS REQUIRED:
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.
ALGORITHM:
Number of comparisons in
5002 MOV CL,[SI]
CL
Go to next memory
5007 INC SI
location
Go to next memory
500B L3 INC SI
location
Compare BC and AL
500F CMP AL,BC
register
DATA
INPUT
OUTPUT
DATA
INPUT
OUTPUT
RESULT:
Thus the given array of numbers are sorted in ascending & descending order.
EX. NO: 10
DATE :
LARGEST & SMALLEST
AIM:
APPARATUS REQUIRED:
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.
ALGORITHM:
i(ni)dingFlargest number:
➢ Load the array count in a register C1.
➢ Get the first two numbers.
➢ Compare the numbers and exchange if the number is small.
➢ Get the third number from the array and repeat the process until C1 is 0.
5018 MOV [DI],AL Else store the biggest number in 5300 location
DATA
INPUT
OUTPUT
DATA
INPUT
OUTPUT
RESULT:
PASSWORD CHECKING
AIM:
APPARATUS REQUIRED:
PROGRAM:
; PASSWORD IS
PASSWORD DB
($-PASSWORD)
INST DB 10 DUP
CODE SEGMENT
EC6513- MICROPROCESSOR AND MICROCONTROLLER 41
LABORATORY
DATA START:
MOV DS, AX
INT 21H
MOV SI, 00
UP1:
MOV AH,
08H INT
21H
CMP AL,
0DH JE
DOWN
MOV [INST+SI],
AL MOV DL,'*'
INT 21H
INC SI
JMP
UP1
DOWN:
MOV BX, 00
MOV CX,
LEN CHECK:
MOV AL,[INST+BX]
MOV DL,
AL, DL
JNE FAIL
INC BX
LOOP
CHECK
INT 21H
JMP FINISH
FAIL:
INT 21H
FINISH:
INT 3
CODE
ENDS END
START
END
RESULT:
Thus the output for the Password checking, Print RAM size and system date
was executed successfully
DATE :
APPARATUS REQUIRED:
PROGRAM;
ROAD
PC6 PC5 RY 2 PC1 PC0 PA2
PC4
G
GYR
ROAD 1
ROAD 3
SEQUENCE D7 D6 D5 D4 D3 D2 D1 D0 VALUE
PORT A 1 0 0 0 0 0 0 0 80H
PORT B 1 0 0 0 0 0 0 0 80H
GRGR
PORT C 0 0 0 1 0 0 1 0 12H
PORT A 0 0 0 1 0 0 0 0 10H
PORT B 0 1 0 0 0 0 0 0 40H
RYRY
PORT C 0 1 0 0 0 0 0 1 41H
PORT A 0 0 0 1 0 1 0 0 14H
PORT B 0 0 1 0 0 0 0 0 20H
RGRG
PORT C 0 1 0 0 0 0 0 0 40H
PORT A 0 0 0 0 1 0 0 0 08H
YRYR
PORT B 1 0 0 0 0 0 0 0 80H
PORT C 0 0 1 0 0 0 1 0 22H
MICROPROCESSOR AND MICROCONTROLLER 46
LABORATORY
START
DELAY
DELAY
DELAY
DELAY
STOP
MICROPROCESSOR AND MICROCONTROLLER 47
LABORATORY
ASSEMBLY LANGUAGE PROGRAM FOR TRAFFIC LIGHT CONTROL:
OUT 26,AL
OUT 20, AL
MOV AL,80
OUT 22, AL
MOV AL,12
OUT 24, AL
CALL DELAY
MOV AL,10
OUT 20, AL
MOV AL,40
OUT 22, AL
MOV AL,41
OUT 24, AL
CALL DELAY
MOV AL,14
OUT 20, AL
MOV AL, 20
OUT 22, AL
MOV AL, 40
OUT 24, AL
MICROPROCESSOR AND MICROCONTROLLER 48
LABORATORY
CALL DELAY
MOV AL, 08
OUT 20, AL
MOV AL,80
OUT 22, AL
MOV AL, 22
OUT 24, AL
CALL DELAY
JMP START
L1 DEC DX
JNZ L1
DEC DI
JNZ L2
RET
▪
MICROPROCESSOR AND MICROCONTROLLER 49
LABORATORY
RESULT:
Thus the assembly language program for traffic light control is verified
MICROPROCESSOR AND MICROCONTROLLER 50
LABORATORY
EX. NO: 13
DATE :
AIM:
APPARATUS REQUIRED:
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:
MEMORY
LOCATION A1 A2 B1 B2 HEX CODE
4500 1 0 0 0 09 H
4501 0 1 0 1 05 H
4502 0 1 1 0 06 H
4503 1 0 1 0 0A H
EC6513- MICROPROCESSOR AND MICROCONTROLLER 52
LABORATORY
FLOWCHART:
RESULT:
Thus the assembly language program for rotating stepper motor in both
clockwise and anticlockwise directions is written and verified.
MICROPROCESSOR AND MICROCONTROLLER 55
LABORATORY
EX. NO: 14
DATE :
AIM :
APPARATUS REQUIRED:
ALGORITHM :
MEMORY
LOCATION OPCODES LABEL PROGRAM COMMENDS
AL = 00 FOR 8 BIT
5000 C6,C0,00 MOV AL, 00 CHARACTER DISPLAY
LEFT ENTRY
SEGMENT DEFINITION:
MICROPROCESSOR AND MICROCONTROLLER 58
LABORATORY
DATA BUS D7 D6 D5 D4 D3 D2 D1 D0
SEGMENTS D C B A DP G F A
MICROPROCESSOR AND MICROCONTROLLER 59
LABORATORY
MICROPROCESSOR AND MICROCONTROLLER 60
LABORATORY
MEMORY
LOCATION OPCODES LABEL PROGRAM COMMENDS
C7,C3,00,11 BX =5100 TO
5000 MOV BX,5100
STORE RESULT
RESULT:
Thus the a character is displayed in 7 segment display and a pressed key is read &
store in memory using 8279 interface kit.
MICROPROCESSOR AND MICROCONTROLLER 61
LABORATORY
EX. NO: 15
DATE :
INTERFACING ANALOG TO DIGITAL CONVERTER USING 8086
AIM:
APPARATUS REQUIRED:
THEORY:
An ADC usually has two additional control lines: the SOC input to tell the
ADC when to start the conversion and the EOC output to announce when the
conversion is complete.
ALGORITHM:
MEMORY
OPCODES PROGRAM COMMENTS
LOCATION
Load accumulator
5000 MOV DX,FF26 with value for ALE
high
Send through output
5003 MOV AL,90
port
Load accumulator
5005 OUT DX,AL with value for ALE
low
Send through output
5006 MOV DX,FF24
port
Store the value to
5009 MOV AL,FF make SOC high in
the accumulator
Send through output
500B OUT DX,AL
port
RESULT:
Thus the ADC was interfaced with 8086 and the given analog inputs were
converted into its digital equivalent.
EX. NO: 16
DATE :
INTERFACING DIGITAL – TO – ANALOG CONVERTER
USING 8086
AIM:
APPARATUS REQUIRED:
PROBLEM STATEMENT:
The program is executed for various digital values and equivalent analog
voltages are measured and also the waveforms are measured at the output ports
using CRO.
THEORY:
Since DAC 0800 is an 8 bit DAC and the output voltage variation is
between –5v and +5v. The output voltage varies in steps of 10/256 = 0.04
(approximately). The digital data input and the corresponding output voltages are
presented in the table. The basic idea behind the generation of waveforms is the
continuous generation of analog output of DAC. With 00 (Hex) as input to DAC2
the analog output is –5v. Similarly with FF H as input, the output is +5v. Outputting
digital data 00 and FF at regular intervals, to DAC2, results in a square wave of
amplitude 5v.Output digital data from 00 to FF in constant steps of 01 to DAC2.
Repeat this sequence again and again. As a result a saw-tooth wave will be
generated at DAC2 output. Output digital data from 00 to FF in constant steps of
01 to DAC2. Output digital data from FF to 00 in constant steps of 01 to DAC2.
FLOECHART
ALGORITHM
Waveform generation
Square Waveform:
MEMORY
OPCODES PROGRAM COMMENTS
LOCATION
Load accumulator
5000 MOV DX,FF26 with value for ALE
high
Send through output
5003 MOV AL,80
port
Load accumulator
5005 OUT DX,AL with value for ALE
low
Send through output
5006 MOV DX,FF22
port
Store the value to
5009 MOV AL,FF make SOC high in
the accumulator
Send through output
500B OUT DX,AL
port
Decrement CX
5105 DEC CX
register
Return to main
5108 RET
address
RESULT
Thus the DAC was interfaced with 8086 and different waveforms have been
generated.
EX. NO: 17
DATE :
8 BIT ADDITION USING ARITHMETIC OPERATION 8051
MICROCONTROLLER
AIM:
ALGORITHM:
OUTPUT:
INPUT OUTPUT
MEMORY MEMORY
DATA DATA
RESULT:
Thus the 8051 ALP for addition of two 8 bit numbers is executed.
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 carry flag.
➢ Initialize the register for borrow.
➢ Get the first operand into the accumulator.
➢ Subtract the second operand from the accumulator.
➢ If a borrow results increment the carry register.
➢ Store the result in memory.
FLOECHART:
8 BIT SUBTRACTION
OUTPUT:
INPUT OUTPUT
Memory Memory
Data Data
RESULT:
Thus the 8051 ALP for subtraction of two 8 bit numbers is executed.
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:
PROGRAM
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.
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:
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.
AIM:
ALGORITHM:
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.
EX. NO: 22
DATE :
FIND 2’S COMPLEMENT OF A NUMBER
AIM:
RESOURCES REQUIERED:
OUTPUT:
RESULT;