Sunteți pe pagina 1din 40

15ME608– MICROPROCESSORS AND MICROCONTROLLER LABORATORY

BANNARI AMMAN INSTITUTE OF TECHNOLOGY


SATHYAMANGALAM – 638 401
DEPARTMENT OF ELECTRONICS AND
COMMUNICATION
ENGINEERING

ACADEMIC YEAR 2019 - 2020

(VI SEMSETER)

Subject Code : 15ME608

Subject Title : MICROPROCESSORS AND MICROCONTROLLERS


LABORATORY

Prepared By Approved By
Dr.C.Poonngodi
HOD/ECE
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

LIST OF EXPERIMENTS

Microprocessor (8085)

1. Addition, Subtraction, Multiplication and Division of two 8 – bit.


2. Addition, Subtraction - 16 bit numbers.
3. Maximum and Minimum number in an array of data.
4. 7 Segment Display Interface

Microprocessor (8086)
5. Arithmetic Operation - 16-bit
6. Arithmetic Operation - 32-bit
7. String Operations
8. Sorting Algorithm

Interfacing

9. Analog to digital conversion.


10. Digital to analog conversion.
11. Traffic Light Controller

Microconrtroller (8051)

12. Addition, Subtraction, Multiplication and Division of two 8 – bit

2
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

3
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

MICROPROCESSOR (8085)

4
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Simple Arithmetic Operations


(8 -bit Addition, Subtraction, Multiplication & Division)

Exp.No:
Date:

Aim:
To write assembly language programs for 8085 microprocessor to perform the following arithmetic
operations:
(a) 8 bit addition
(b) 8 bit subtraction
(c) 8 bit multiplication and
(d) 8 bit by 8 bit division.

Apparatus Required:
1.8085 Trainer
2. Operation Code sheet

Programs:

(a) 8 bit addition

Memory
Operation Code Label Mnemonics Comments
Address
4100 MVI D,00
4101
4102 LDA 4200
4103
4104
4105 MOV B,A
4106 LDA 4201
4107
4108
4109 ADD B

5
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

410A JNC LOOP

410B

410C
410D INR D
410E LOOP STA 4500
410F
4110
4111 MOV A,D
4112 STA 4501
4113
4114
4115 HLT

(b) 8 bit subtraction

Memory
Operation Code Label Mnemonics Comments
Address
4200 MVI D,00
4201
4202 LDA 4250
4203
4204
4205 MOV B,A
4206 LDA 4251
4207
4208
4209 SUB B
420A JNC LOOP
420B
420C
420D DCR D
6
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

420E LOOP STA 4252


420F
4210
4211 MOV A,D
4212 STA 4253
4213
4214
4215 HLT

(c) 8 bit multiplication

Memory
Operation Code Label Mnemonics Comments
Address
4300 MVI C, 00
4301
4302 LDA 4350
4303
4304
4305 MOV B, A
4306 LDA 4351
4307
4308
4309 MOV D,A
430A XRA A
430B Loop 2: ADD B
430C JNC Loop 1
430D
430E
430F INR C
4310 Loop 1: DCR D
4311 JNZ Loop 2

7
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

4312
4313
4314 STA 4352
4315
4316
4317 MOV A,C
4318 STA 4353
4319
431A
431B HLT

(d) 8 bit division

Memory
Operation Code Label Mnemonics Comments
Address
4400 LDA 4200
4401
4402
4403 MOV B, A
4404 LDA 4201
4405
4406
4407 MVI C,00
4408
4409 LOOP 2 CMP B
440A JC LOOP1
440B
440C
440D SUB B
440E INR C
440F JMP LOOP2

8
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

4410
4411
4412 LOOP 1 STA 4202
4413
4414
4415 MOV A, C
4416 STA 4203
4417
4418
4419 HLT

Observations:

Program Address & Data Result

Addend : LSB:
8-Bit Addition
Augend : MSB:
Subtrahend : LSB :
8-Bit Subtraction
Minuend: MSB:
Multiplicand : LSB :
8-Bit Multiplication
Multiplier : MSB:
Dividend: Quotient:
8-Bit Division
Divisor: Remainder:

Viva Questions:

1. What is microprocessor?
2. Which is the first microprocessor?
3. Define CPU.
4. What is the difference between bit & byte ?

9
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Result:
Thus assembly language programs are written for 8085 microprocessor to perform the following
arithmetic operations:
(e) 8 bit addition
(f) 8 bit subtraction
(g) 8 bit multiplication and
(h) 8 bit by 8 bit division.
The above programs checked by executing using 8085 trainer.

Simple Arithmetic Operations


(16-bit Addition, Subtraction, Multiplication & Division)

10
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Exp.No:
Date:

Aim:
To write assembly language programs for 8085 microprocessor to perform the following arithmetic
operations:
(a) 16 bit addition
(b) 16 bit subtraction
Apparatus Required:
1.8085 Trainer
2. Operation Code sheet

Programs:

(a) 16 bit addition

Memory
Operation Code Label Mnemonics Comments
Address
4100 LHLD 4000H
4103 XCHG
4104 LHLD 4002H
4107 MOV A, E
4108 ADD L
4109 MOV L,A
410A MOV A, D
410B ADCH
410C MOV H, A
410E SHLD 4004H
4111 HLT

(b) 16 bit subtraction

11
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Memory
Operation Code Label Mnemonics Comments
Address

12
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

4100 LHLD 4000H


4103 XCHG
4104 LHLD 4002H
4107 MOV A, E
4108 SUB L
4109 MOV L,A
410A MOV A, D
410B SBB H
410C MOV H, A
410D SHLD 4004H
4110 HLT

Observations:

Program Address & Data Result

Addend : LSB:
16 -Bit Addition
Augend : MSB:
Subtrahend : LSB :
16 -Bit Subtraction
Minuend: MSB:

VIVA Questions:
1. What is RET instructions?
2. Specify the matrix format used in the microprocessor
3. What is the purpose of STAX instructions?
4. List the various types of JMP instructions.
5. Give the bit field for CALL instructions.

13
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Result:
Thus assembly language programs are written for Intel 8085 microprocessor to
perform the following arithmetic operations:
(a) 16 bit addition
(b) 16 bit subtraction
The above programs checked by executing using 8085 trainer.
Maximum and Minimum number
Exp.No:
Date:

Aim:
To write assembly language programs to find the maximum and minimum values from a given
array of numbers using 8085 microprocessor.
14
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Apparatus Required:
1.8085 Trainer
2. Operation Code sheet
Programs:

Memory
Operation Code Label Mnemonics Comments
Address
4200 LXI H,4250
42001
4202
4203 MOV B,M
4204 INX H
4205 MOV A,M
4206 DCR B
4207 Loop: INX H
4208 CMP M
JNC Loop 1(JC Loop
4209
1)*
420A
420B
420C MOV A,M
420D Loop 1: DCR B
420E JNZ Loop
420F
4210
4211 INX H
4212 MOV M,A
4213 HLT

* For finding minimum value in an array

15
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Observations:

Result
Program Address & Data Ascending Descending
Order Order
4250 :
4251 :
4252 :
4253 : Maximum Minimum
Maximum / Minimum Value
4254 : Value at Value at
in an Array
4255 : 4258 : 4258 :
4256 :
4257 :
4258 :

Viva Questions:

1. What is mnemonic?
2. What is assembler?
3. Define ALU.
4. Name the general purpose registers used in microprocessor 8085.

Result:
Thus the assembly language programs to find the maximum and minimum values from a
given array of numbers using 8085 was written and executed executed using 8085 trainer.

Interface Keyboard and Display Controller (IC 8279)


Exp.No:
Date:

Aim:
To write an assembly language program for interfacing the Programmable Keyboard and
Display Controller (IC 8279) with 8085 microprocessor.
Apparatus Required:

16
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

1. 8085 Trainer
2. Operation Code sheet
3. Programmable Keyboard and Display Controller (IC 8279) interface board
Programs:

Address Operation Code Label Mnemonics


4500 Start: LXI H, 4550
4501
4502
4503 MVI D,0F
4504
4505 MVI A,10
4506
4507 OUT C2
4508
4509 MVI A,CC
450A
450B OUT C2
450C
450D MVI A,90
450E
450F OUT C2
4510
4511 Loop: MOV A,M
4512 OUT C0
4513
4514 CALL Delay
4515
4516
4517 INX H

17
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

4518 DCR D
4519 JNZ Loop
451A
451B
451C JMP Start
451D
451E
451F Delay: MVI B.A0
4520
4521 Loop1: MVI C,FF
4522
4523 Loop2: DCR C
4524 JNZ Loop2
4525
4526
4527 DCR B
4528 JNZ Loop1
4529
452A
452B RET

VIVA Questions:

1. How many machine cycles are needed for executing LDA instructions
2. How many t states are needed for executing call instructions
3. How many interrupt signal are placed in 8085
4. Which interrupts has the high priority
5. Which interrupts is a non-mask able interrupt

18
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Result:
Thus an assembly language program for interfacing the programmable keyboard and display
controller (8279) with 8085 microprocessor was written and executed successfully.

19
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

MICROPROCESSOR (8086)

20
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Arithmetic Operations
Exp.No:
Date:

Aim:
To write assembly language program to perform simple arithmetic operations, like
Addition, Subtraction, and Multiplication & Division using 8086 Microprocessor.

Apparatus Required:
1. 8086 Microprocessor kit
2. Power Supply Chord
3. Keyboard

Program:

(i) Addition without Carry:

MOV AX, 1230


MOV BX, 2300
ADD AX, BX
MOV [2000], AX
HLT

(ii) Addition with Carry:

MOV AX, 9999


MOV BX, 8999
MOV CX,0000
ADD AX, BX
JNC L1
INC CX
L1: MOV [1300], CX
MOV [1200], AX
HLT
(iii) Subraction without Borrow:

MOV AX, 1300


MOV BX, 1100
21
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

SUB AX, BX
MOV [2000], AX
HLT

(iv) Subraction with Borrow:

MOV AX, 9999


MOV BX, CCCC
MOV CX, 0000
SUB AX, BX
JNC L1
INC CX
L1: MOV [3000], AX
MOV [3002], CX
HLT

(v) Multiplication:
MOV AX, 2A2B
MOV BX, 1260
MUL BX
MOV [1200], AX
MOV [1300], DX
HLT

(vi) Division:
MOV AX, 2A2B
MOV BX, 1260
DIV BX
MOV [1200], AX
MOV [1300], DX
HLT

22
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Viva questions:

1. What is the difference between min mode and max mode of 8086?
2. What is the difference between near and far procedure?
3. What is the difference between Macro and procedure?
4. What is the difference between instructions RET & IRET?
5. What is the difference between instructions MUL & IMUL?
6. What is the difference between instructions DIV & IDIV?
7. What is difference between shifts and rotate instructions?
8. Which are strings related instructions?
9. Which are addressing modes and their examples in 8086?
10. What does u mean by directives?

Result:
Thus the assembly language program was to perform arithmetic operations using 8086
microprocessor was written and executed successfully.
23
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

String Operation
Exp.No:
Date:

Aim:
To write a assembly language program for performing simple string operation, like to search a
word from a string, to find and replace a word from a string using, to copy a string of data words
from one location to the other using 8086 Microprocessor.
Apparatus Required:
1. 8086 Microprocessor kit
2. Power Supply Chord
3. Keyboard

(i) Search a Word


Program:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
LIST DW 53H, 15H, 19H, 02H
DEST EQU 3000H
COUNT EQU 05H
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV AX, 15H
MOV SI, OFFSET LIST
MOV DI, DEST
MOV CX, COUNT
MOV AX, 00
CLD
REP SCASW
JZ LOOP
MOV AX, 01

24
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

LOOP MOV [DI], AX


MOV AH, 4CH
INT 21H
CODE ENDS
END START

INPUT:
LIST: 53H, 15H, 19H, 02H
OUTPUT:
3000 01

(ii) Find and Replace a Word


Program:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
LIST DW 53H, 15H, 19H, 02H
REPLACE EQU 30H
COUNT EQU 05H
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV AX, 15H
MOV SI, OFFSET LIST
MOV CX, COUNT
MOV AX, 00
CLD
REP SCASW
JNZ LOOP
MOV DI, LABEL LIST
MOV [DI], REPLACE

25
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

LOOP MOV AH, 4CH


INT 21H
CODE ENDS
END START

INPUT:
LIST: 53H, 15H, 19H, 02H
OUTPUT:
LIST: 53H, 30H, 19H, 02H

(iii) Copy a String


Program:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
SOURCE EQU 2000H
DEST EQU 3000H
COUNT EQU 05H
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV ES, AX
MOV SI, SOURCE
MOV DI, DEST
MOV CX, COUNT
CLD
REP MOVSW
MOV AH, 4CH
INT 21H
CODE ENDS
END START

26
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

INPUT: OUTPUT:
2000 48 3000
2001 84 3001
2002 67 3002
2003 90 3003
2004 21 3004

Result:

Thus assembly language program to perform simple string operation, like to search a word
from a string, to find and replace a word from a string using, to copy a string of data words from
one location to the other using 8086 Microprocessor was written and executed successfully.

27
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Sorting
Exp.No:
Date:

Aim:

To write a assembly language program for sorting the given numbers in ascending and
descending order using 8086 Microprocessor.

Apparatus Required:
1. 8086 Microprocessor kit
2. Power Supply Chord
3. Keyboard

Program:

(i) Ascending:

MOV DX, [1500]


L1: MOV CX, DX
MOV SI, [1505]
L2: MOV AX, [SI]
CMP AX, [SI]
JL L3
XCHG [SI+2], AX
XCHG [SI], AX
L3: ADD SI, 02
LOOP L2
DEC DX
JNZ L1
HLT

(ii) Descending:

MOV DX, [1500]


L1: MOV CX, DX
MOV SI,[1505]
L2: MOV AX,[SI]

28
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

CMP AX,[SI]
JG L3
XCHG [SI+2], AX
XCHG [SI],AX
L3: ADD SI,02
LOOP L2
DEC DX
JNZ L1
HLT

Viva questions:
1. What is the size of instruction queue in 8088?
2. Which are the registers present in 8086?
3. What is pipelining in 8086?
4. How many 16 bit registers are available in 8086?
5. Specify addressing modes for any instruction?
6. What is assembler directives?
7. What .model small stands for?
8. What is the supply requirement of 8086?
9. What is the relation between 8086 processor frequency & crystal frequency?
10. Functions of Accumulator or AX register?

29
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Result:

Thus assembly language program to sort the given numbers in ascending and descending
order using 8086 Microprocessor was written and executed successfully.

30
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Interface ADC & DAC


Exp.No:
Date:

Aim:
To write an assembly language program for interfacing the ADC & DAC with 8086
microprocessor.
Apparatus Required:
1. 8086 Trainer
2. ADC& DAC interface board
Program:
DAC - To Generate the Square Waveform in the DAC
DAC EQU 0C0H
1000H
START:
MOV AL,00H
OUT DAC,AL
CALL DELAY
MOV AL,0FFH
OUT DAC,AL
DELAY
JMP START
DELAY:
L1:MOV CX,05FFH
LOOP L1
RET
CODE ENDS

To Generate the Triangular Wave Form in the DAC

DAC EQU 0C0H


START:
MOV AL, 00H
31
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

L2:
OUT DAC, AL
INC AL
JNZ L2
JMP START
DELAY:
MOV CX, 05FFH
L1:
LOOP L1
RET
CODE ENDS
END

ADC : To study the value of digital binary word for a given analog
voltage

CHSEL EQU 0E0H


SOC EQU 0D0H
EOC EQU 0D8H
ADCDATA EQU 0C8H
START:
MOV AL,10H
OUT CHSEL,AL
MOV AL,18H
OUT CHSEL,AL
HLT

ADC : To study the value of digital binary word for a given analog
voltage using SOC pulse

CHSEL EQU 0E0H

32
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

SOC EQU 0D0H


EOC EQU 0D8H
ADCDATA EQU 0C8H
STOREDATA EQU 1500H

MOV AL,10H
OUT CHSEL,AL
MOV AL,18H
OUT CHSEL,AL
MOV AL,01H
OUT SOC,AL
MOV AL,00H
OUT SOC,AL
LOOP:
IN AL,EOC
AND AL,01H
CMP AL,01H
JNZ LOOP
IN AL,ADCDATA
MOV SI,STOREDATA
MOV [SI],AL
HLT

Viva questions:
1. What is the Resolution of a 6 bit DAC
2. How many equal intervals are present in a 14-bit D-A converter?
3. Non-linearity in the output of converter is expressed in ---------------
4. List the source of errors in ADC.
5. List the advantages of flash type A/D converter

Result:

33
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Thus an assembly language program has been written and verified to interface the ADC and
DAC with 8086 microprocessor.

Interface Elevator
Exp.No:
Date:

Aim:
To write an assembly language program for interfacing the elevator with 8086
microprocessor.
Apparatus Required:
1. 8086 Trainer
2. Elevator interface board
Program:
TO MOVE THE LIFT1 TO 4TH FLOOR AND TO GIVE A BEEP.

LIFT1 EQU 00C0H


LIFT2 EQU 00C4H
STIN EQU 00C8H
STOU EQU 00CCH

MOV AL,03H ;DEFAULT OPEN


OUT STOU,AL ;DOORS OF LIFIT1
CALL DELAY ; AND LIFT2
MOV AL,02H ;CLOSE DOOR OF
OUT STOU,AL
MOV AL,80H ;INDICATE LIFT1
OUT LIFT1,AL ;IS IN GND FLOOR
MOV AL,01H ;INDICATE LIFT2
OUT LIFT2,AL ;IS IN 7TH FLOOR
CALL DELAY
MOV AL,40H ;LIFT IN FIRST FLOOR
OUT LIFT1,AL
34
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

CALL DELAY
MOV AL,20H ;LIFT1 IN
OUT LIFT1,AL ;SECOND FLOOR AND FLOOR
CALL DELAY
MOV AL,10H ;LIFT IN
OUT LIFT1,AL ;THIRD FLOOR
CALL DELAY
MOV AL,08H ;LIFT1 IN
OUT LIFT1,AL ;FOURTH FLOOR
MOV AL,0BH ;BEEP FOR DOOR
OUT STOU,AL ;OPEN
CALL DELAY
MOV AL,03H ;OPEN DOOR
CC OUT STOU,AL
HLT
DELAY:
MOV CL, 02H;
LOOP1:
MOV BX, 0F9FEH
LOOP:
DEC BX
MOV AL,BL
OR AL,BH
JNZ LOOP
DEC CL
JNZ LOOP1
RET
END

35
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Viva questions:
1. What are SIM and RIM instructions?
2. What is the difference between Macro and Procedure?
3. How many I/O lines are available on the 82C55A
4. Give examples for Maskable interrupts?
5. What is the position of the Stack Pointer after the PUSH instruction?

Result:

36
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Thus an assembly language program has been written and verified to interface the elevator
with 8086 microprocessor

MICROCONTROLLER (8051)

37
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Simple Arithmetic Operations


(8 -bit Addition, Subtraction, Multiplication & Division)

Exp.No:
Date:

Aim:
To write assembly language programs for 8051 microcontroller to perform the following arithmetic
operations:
 8 bit addition
 8 bit subtraction
 8 bit multiplication and
 8 bit by 8 bit division

Apparatus Required:
 8051 Microcontroller kit
 Power Supply Chord
 Keyboard

Program:

(i) Addition:

CLR C
MOV A,#data1
ADD A,#data2
MOV DPTR,#4500
MOVX @DPTR,A
HERE: SJMP HERE
(ii) Subtraction

CLR C
MOV A,#data1
SUBB A,#data2
38
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

MOV DPTR,#4500
MOVX @DPTR,A
HERE: SJMP HERE

(iii) Multiplication

CLR C
MOV A,#data1
MOV B,#data2
MUL AB
MOV DPTR,#4500
MOVX @DPTR,A
INC DPTR
MOV A,B
MOVX @DPTR,A
HERE: SJMP HERE

(iv) Division

CLR C
MOV A,#data1
MOV B,#data2
DIV AB
MOV DPTR,#4500
MOVX @DPTR,A
INC DPTR
MOV A,B
MOVX @DPTR,A
HERE: SJMP HERE

Viva Questions:

What is microcontroller?

What are registers in microcontroller?

Which architecture is followed in 8051?

What is the difference between bit & byte ?

39
15ME608– MICROPROCESSORS AND MICROCONTROLLERS LABORATORY

Result:
Thus assembly language programs are written for 8051 microcontroller to perform the following
arithmetic operations:
 8 bit addition
 8 bit subtraction
 8 bit multiplication and
 8 bit by 8 bit division.
The above programs checked by executing using 8051 trainer.

40

S-ar putea să vă placă și