Вы находитесь на странице: 1из 34

Microprocessor Lab

For
IV Semester Electronics & Communication

Department of Electronics & Communication

Sri Siddhartha Institute of Technology


Maralur, Tumkur

CONTENTS
8085 MICROPROCESSOR LAB PROGRAMS
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.

To move data block from one location to other without overlap


To move data block from one location to other with overlap
To arrange a set of 8-bit numbers in ascending order
Addition of binary numbers
To add two multibyte binary numbers
To add 2-digit BCD numbers
To subtract 16-bit binary numbers
To check the fourth bit of a byte
To generate resultant byte for given Boolean equation
Successive addition of two unsigned binary numbers
To find the product of two unsigned binary numbers
To divide two 16 bit numbers
To implement counter from 00-99
To implement counter from 99-00
To implement counter from 00-FF
To implement counter from FF-00
To check 2 out of 5 code
To add N one byte binary numbers
To realize real time clock
To convert binary to BCD equivalent
To convert binary to ASCII equivalent
To convert ASCII to binary equivalent
To convert BCD to binary equivalent

INTERFACING PROGRAMS
24.
25.
26.
27.
28.
29.
30.

To generate square wave of given duty cycle using DAC


To generate a triangular waveform using DAC
To generate a staircase waveform using DAC
To sense a keyboard
To implement a moving display of a given string of digits
To display a message on the display unit using 8279 chip
To simulate throw of a dice

Sri Siddhartha Institute of Technology


1) (a) An ALP to transfer a given block of data from source memory block to destination memory block with

out overlap
data segment
var1 dw 12h,34h,45h,67h,56h
cnt dw 5
res dw ?
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov ax,cnt
mov si,0000h
next: mov ax,var1[si]
mov res[si],ax
inc si
inc si
loop next
mov ah,4ch
int 21h
code ends
end start

Department of Electronics & Communication

Sri Siddhartha Institute of Technology

1 (b) An ALP to transfer a given block of data from source memory block to destination memory block with
overlap
data segment
y db 3 dup(0)
x db 11h,22h,33h,44h,55h
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
lea si,x
lea di,y
mov cx,0005h
loc1: mov al,[si]
mov[di],al
inc si
inc di
dec cx
jnz loc1
mov ah,4ch
int 21h
code ends
end start

Department of Electronics & Communication

Sri Siddhartha Institute of Technology

2) An ALP to add 16-bit bytes/words & to find the average of numbers.

data segment
N1 dw 0020h,0002h,0002h,0002h
res dw ?
cnt db 04h
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov cl,cnt
mov si,0000h
mov dx,0000h
next: mov ax,N1[si]
add dx,ax
inc si
inc si
loop next
mov ax,dx
div cnt
mov res,ax
mov ah,4Ch
int 21h
code ends
end start

Department of Electronics & Communication

Sri Siddhartha Institute of Technology

3) An ALP to multiply two 32 bit numbers

data segment
n1 dw 0AFFh,0AFFh
n2 dw 0330h,4002h
res dw ?
data ends
code segment
assume cs:code,ds:data
mov ax,data
start:
mov ds,ax
mov si,0000h
mov ax,n1[si]
mul n2[si]
mov res,ax
mov bx,dx
mov ax,n1[si+2]
mul n2[si]
add bx,ax
mov cx,dx
mov ax,n1[si]
mul n2[si+2]
add bx,ax
adc cx,dx
mov res+2,bx
mov ax,n1[si+2]
mul n2[si+2]
mul n2[si+2]
add cx,ax
mov res+4,cx
adc dx,0000h
mov res+6,dx
mov ah,4ch
int 21h
code ends
end start

Department of Electronics & Communication

Sri Siddhartha Institute of Technology

4)An ALP to multiply two ASCII byte numbers


data segment
n1 db '3'
n2 db '2'
res db ?
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov al,n1
mov bl,n2
sub al,30h
sub bl,30h
mul bl
aam
add ax,3030h
mov res,al
mov res+1,ah
mov ah,4Ch
int 21h
code ends
end start

Department of Electronics & Communication

Sri Siddhartha Institute of Technology

5)(a) An ALP to find LCM of two 16 bit unsigned integers.


data segment
n1 dw 019h
n2 dw 00Fh
lcm dw 2 dup(?)
data ends
code segment
assume cs:code,ds:datastart:
Start:
mov ax,data
mov ds,ax
mov ax,n1
mov bx,n2
mov dx,0000h
again: push ax
push dx
div bx
cmp dx,0000h
je exit
pop dx
pop ax
add ax,n1
jnc nincdx
inc dx
nincdx: jmp again
exit: pop lcm+2
pop lcm
mov ah,4ch
int 21h
code ends
end start

Department of Electronics & Communication

Sri Siddhartha Institute of Technology

5)(b) An ALP to find GCF of two 16 bit unsigned integers.


data segment
n1 dw 005Ah,0078h
res dw ?
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov ax,n1
mov bx,n1+2
again: cmp ax,bx
je exit
jb big
above: mov dx,0h
div bx
cmp dx,0
je exit
mov ax,dx
jmp again
big: xchg ax,bx
jmp above
exit: mov res,bx
mov ah,4Ch
int 21h
code ends
end start

Department of Electronics & Communication

Sri Siddhartha Institute of Technology

6)(a) An ALP to sort a given set of 16 bit unsigned integers into ascending order using insertion sort.
Program to sort a given a 16bit unsigned integers into ascending order using insertion sort
data segment
a dw 78h,34h,12h,56h
si_ze dw ($-a)/2
data ends
code segment
assume cs:code,ds:data
start : mov ax,data
mov ds,ax
mov cx,2
outloop: mov dx,cx
dec dx
mov si,dx
add si,si
mov ax,a[si]
inloop : cmp a[si-2],ax
jbe inexit
mov di,a[si-2]
mov a[si],di
dec si
dec si
dec dx
jnz inloop
inexit : mov a[si],ax
inc cx
cmp cx,si_ze
jbe outloop
int 21h
code ends
end start
Department of Electronics & Communication

Sri Siddhartha Institute of Technology

6)(b) An ALP to sort a given set of 16 bit unsigned integers into ascending order using bubble sort.
data segment
a db 34h,78h,12h,56h
size dw $-a
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov bx,size
dec bx
outloop: mov cx,bx
mov si,0
inloop: mov al,a[si]
inc si
cmp al,a[si]
jb nochang
xchg al,a[si]
mov a[si-1].al
nochang: loop inloop
dec bx
jnz outloop
mov ah,4ch
int 21h
code ends
end start

Department of Electronics & Communication

Sri Siddhartha Institute of Technology

7) An ALP to generate 10 fibonacci numbers.(Read initial values via key board)


data segment
n db 01fh
fib db 15 dup(?)
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov bx,0
term : mov dl,0
push bx
call fibo
pop bx
cmp dx,n
ja exit
mov fib[bx],dx
inc bx
jmp term
exit : mov ah,4ch
int 3
fibo : cmp bx,0
je exit1
cmp bx,1
je exit2
dec bl
push bx
call fibo
pop bx
dec bx
call fibo
ret
exit1: ret
exit2: inc dl
ret
align 16
code ends
end start

Department of Electronics & Communication

10

Sri Siddhartha Institute of Technology

8) An ALP to generate prime numbers from 1 to 50 BCD.


data segment
x db 2,14 dup(?)
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov dl,x
lea si,x+1
mov ch,14
loc1: mov dh,02
inc dl
loc2: mov ah,0
mov al,dl
div dh
cmp ah,0
je loc1
inc dh
cmp dh,dl
jb loc2
mov al,1
mul dl
aam
mov cl,04
rol al,cl
ror ax,cl
mov[si],al
inc si
dec ch
jnz loc1
mov ah,4ch
int 21h
code ends
end start

Department of Electronics & Communication

11

Sri Siddhartha Institute of Technology

9)An ALP to transfer given source string to destination string using string instructions.
Data segment
d1 db "welcome","$"
d2 db 10dup(0)
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov es,ax
mov cx,07h
cld
mov si,offset d1
mov di,offset d2
rep movsb
mov cx,07h
std
mov si,offset d1+6
mov di,offset d2+14
rep movsb
mov ah,4ch
int 21h
code ends
end start

Department of Electronics & Communication

12

Sri Siddhartha Institute of Technology

10)An ALP to perform the following operations.


(a) Reverse a string.
data segment
m1 db 10,13,'enter the string:$'
m2 db 10,13,'reverse of a string:$'
buff db 80
db 0
db 80 dup(0)
counter1 dw 0
counter2 dw 0
data ends
code segment
assume cs: code, ds:data
start: mov ax,data
mov ds,ax
mov ah,09h
mov dx,offset m1
int 21h
mov ah,0ah
lea dx,buff
int 21h
mov ah,09h
mov dx,offset m2
int 21h
lea bx,buff
inc bx
mov ch,00
mov cl,buff+1
mov di,cx
back: mov dl,[bx+di]
mov ah,02h
int 21h
dec di
jnz back
exit: mov ah,4ch
int 21h
code ends
end start

Department of Electronics & Communication

13

Sri Siddhartha Institute of Technology

(b)Deleting a word from a string.


data segment
x db 'aa','bb', 'cc','dd','ee','ff'
z dw (z-x)/2
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov es,ax
lea di,x
mov cx,z
cld
mov ax,'cc' ;word to be deleted
repne scasw
cmp cx,0
je loc2
mov ax,[di]
loc1: mov [di-2],ax
inc di
inc di
dec cx
jnz loc1
mov byte ptr[di-2],'$'
loc2: lea dx,x
mov ah,09h
int 21h
mov ah,4ch
int 21h
code ends
end start

Department of Electronics & Communication

14

Sri Siddhartha Institute of Technology

c)Searching a word from a string.


data segment
n1 db 12h,14h,78h,67h,34h
key db 23h
cnt db 5
m1 db 'the key found in'
res db 'the position ',13h,10h,'$'
m2 db 'not found',13h,10h,'$'
data ends
code segment
assume cs: code,ds:data
start: mov ax,data
mov ds,ax
mov si,00h
mov cx,cnt
next: mov al,n1[si]
cmp al,key
jz suc
inc si
loop next
jmp fall
suc: mov ax,si
add al,01h
add al,'0'
mov res,al
lea dx,m1
jmp exit
fall: lea dx,m2
jmp exit
exit: mov ah,09h
int 21h
mov ah,4ch
int 21h
code ends
end start

Department of Electronics & Communication

15

Sri Siddhartha Institute of Technology

(d) To check whether a string is palindrome or not.


data segment
inst db 20 dup(0)
mes1 db 0Ah,0Dh,"insert the string:$"
mes2 db 0Ah,0Dh,"it is a palindrome:$"
mes3 db 0Ah,0Dh,"it is not a palindrome:$"
data ends
code segment
assume cs:code,ds:data
start:

up:

down:
check:

fail:

finish:

term:

mov ax,data
mov ds,ax
mov ah,09h
lea dx,mes1
int 21
mov bx,00h
mov ah,01h
int 21h
cmp al,0Dh
jz down
mov[inst+bx],al
inc bx
jmp up
mov di,00h
dec bx
mov al,[inst+bx]
cmp al,[inst+di]
jne fail
inc di
dec bx
jnz check
jmp finish
mov ah,09h
lea dx,mes3
int 21h
jmp term
mov ah,09h
lea dx,mes2
int 21h
mov ah,4Ch
int 21h

code ends
end start

Department of Electronics & Communication

16

Sri Siddhartha Institute of Technology

11) An ALP to multiply two matrices .


data segment
ar1 db 1h,2h,-3h
ar2 db 4h,5h,6h
ar3 db 2h,-1h,3h
bc1 db 2h,4h,-4h
bc2 db 3h,-2h,5h
bc3 db 1h,5h,2h
c db 9 dup (?)
l2 db (?)
l1 db (?)
data ends
code segment
assume cs:code,ds:data
start:

repeat2:
repeat1:

again:

mov ax,data
mov ds,ax
mov es,ax
mov bp,0h
mov l2,3h
lea si,ar1
lea di,bc1
mov l1,3h
mov cx,3h
mov bx,0h
mov dl,0h
mov al,[si][bx]
imul byte ptr[di][bx]
add dl,al
inc bx
loop again
mov ds:c[bp],dl
inc bp
add di,3h
dec l1
jne repeat1
add si,3h
dec l2
jne repeat2
mov ah,4ch
int 21h

code ends
end start

Department of Electronics & Communication

17

Sri Siddhartha Institute of Technology

12)(a) An ALP to find trace of a matrix.


data segment
matrix db 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh ;3*3
row dw 0003h ;no. of rows
col dw 0003h ;no. of cols
trace dw ?
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov si,00h
mov bx,00h
mov ax,row
cmp ax,col
jnz fail
mov ax,00h
mov cx,row
again: add al,matrix[si][bx]
jnc skip
inc ah
skip: inc si
add bx,col
loop again
mov trace,ax
jmp ovr
fail: mov trace,00h
ovr: mov ah,4ch
int 21h
code ends
end start

Department of Electronics & Communication

18

Sri Siddhartha Institute of Technology

12)(b) An ALP to find the norms of the matrix.


Program to find trace of the matrix
data segment
matrix db 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh ;3x3row dw 0003h ;no. of rows
col dw 0003h ;no. of cols
norm dw 2 dup (0000h)
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov si,00h
mov bx,00h
mov ax,row
cmp ax,col
jnz fail
mov cx,row
again: mov ax,norm
mov al,matrix[si][bx]
mul matrix[si][bx]
mov ax,norm
jnc skip
add norm+2,01h
inc ah
skip: mov norm,ax
inc si
add bx,0003h
loop again
jmp ovr
fail: mov norm,00h
ovr: mov ah,4ch
int 21h
code ends
end start

Department of Electronics & Communication

19

Sri Siddhartha Institute of Technology

13)An ALP to search that implements binary search algorithm.


data segment
x dw 11h,22h,33h,44h,55h,66h,77h
z dw (z-x)
key dw 66h
y dw ?
data ends
code segment
assume cs:code,ds:data
start:

loc3:

loc5:

loc4:
loc1:

loc2:

mov ax,data
mov ds,ax
mov cx,key
mov dx,z
dec bx
mov bx,0
mov si,bx
add si,1
and si,0fffeh
cmp cx,x[si]
je loc1
jb loc2
add si,2
mov bx,si
cmp bx,dx
jna loc3
mov y,0
mov ah,4ch
int 21h
shr si,1
inc si
mov y,si
jmp loc1
sub si,2
mov dx,si
jmp loc5
mov ah,4ch
int 21h

code ends
end start

Department of Electronics & Communication

20

Sri Siddhartha Institute of Technology

Part-II 8051 8-bit Microcontroller


1. Program to transfer a block from source to destination
ADDRESS
8000
8003
8005
8007
8009
800A
800C
800D
800F
8010
8012

Department of Electronics & Communication

LABEL

BACK

MNEMONIC
MOV DPTR,#9000H
MOV R0,#04H
MOV R1,#90H
MOV R2,#91H
MOVX A,@DPTR
MOV 83H,R2
MOVX @DPTR,A
MOV 83H,R1
INC DPTR
DJNZ R0,8009(BACK)
LCALL 0003

21

Sri Siddhartha Institute of Technology

2. Program to exchange data between two blocks


Starting address of block1, data memory 9000& starting address of block2, data memory 9100.

ADDRESS
8000
8003
8005
8007
8009
800A
800B
800D
800E
8010
8011
8012
8014
8015
8017
8018
801A

Department of Electronics & Communication

LABEL

MNEMONIC
MOV DPTR, #9000H
MOV R0, #04H
MOV R1, #90H
MOV R2, #91H
MOVX A, @DPTR
MOV R3, A
MOV 83H,R2
MOVX A, @DPTR
MOV 83H,R1
MOVX @DPTR, A
MOV A, R3
MOV 83H,R2
MOVX @DPTR, A
MOV 83H,R1
INC DPTR
DJNZ R0, 8009
LCALL 0003

22

Sri Siddhartha Institute of Technology


3.Program to find average of n numbers.
ADDRESS
LABEL
8000
8003
8005
8007
8009
800A
800C
BACK
800D
800E
800F
8010
8011
8013
8014
AHEAD
8015
8017
8019
801A
801B
AGAIN
801C
801D
801F
8021
NEXT
8024
8025
8026
8027
8028
8029
802A
802C
LOC
802D
802F
END

Department of Electronics & Communication

MNEMONIC
MOV DPTR,#9000H
MOV R0,#O4H
MOV R1,#00H
MOV R2,#00H
CLR C
MOV R4,#04H
MOVX A,DPTR
MOV R3,A
INC DPTR
MOV A,R1
ADD A,R3
JNC 8014H(AHEAD)
IND R2
MOV R1,A
DJNZ R0,800CH
MOV R5,#00H
CLR C
MOV A,R1
SUBB A,R4
INC R5
JC 8021H
SJMP 801BH
CJNE R2,#00H,802CH
DEC R5
ADD A,R4
MOVX @DPTR,A
MOV A,R5
INC DPTR
MOVX @DPTR,A
SJMP 802FH(END)
DEC R2
SJMP 801BH
LCALL 0003

23

Sri Siddhartha Institute of Technology

4. Program to multiply a 16 bit number with an 8 bit number


8 bit stored at data memory 9000 & 16 bit stored at data memory 9001 & 9002, result stored at data memory 9003, 9004 &
9005.
ADDRESS
8000
8003
8004
8005
8006
8007
8008
8009
800B
800C
800D
800E
8010
8012
8013
8014
8015
8017
8018
8019
801A
801B
801C
801D
801E
801F
8021
8022
8023
8024
8026

LABEL

MNEMONIC
MOV DPTR,#9000
MOVX A,@DPTR
MOV RO,A
INC DPTR
MOVX A,DPTR
MOV R1,A
INC DPTR
MOVX A,DPTR
MOV F0,A
MOV A,RO
MUL AB
MOV R3,A
MOV R4,F0
MOV F0,R1
MOV A,R0
MUL AB
MOV R5,A
MOV R6,F0
INC DPTR
MOV A,R3
MOVX @DPTR,A
MOV A,R4
CLR C
INC DPTR
ADD A,R5
MOVX @DPTR,A
MOV A,#00
ADDC A,R6
INC DPTR
MOVX @DPTR,A
LCALL 0003

.
Department of Electronics & Communication

24

Sri Siddhartha Institute of Technology

5. Program to generate 10 Fibonacci numbers.


Stored in data memory address 9000 & 9001

ADDRESS
8000
8003
8005
8006
8007
8008
8009
800A
800B
800C
800D
800F

Department of Electronics & Communication

LABEL

BACK

MNEMONIC
MOV DPTR,#9000
MOV R3,#08
MOVX A,@DPTR
MOV R0,A
INC DPTR
MOVX A,@DPTR
XCH A,R0
ADD A,R0
INC DPTR
MOVX @DPTR,A
DJNZ R3,BACK(8009)
LCALL 0003

25

Sri Siddhartha Institute of Technology

. Program to find GCD & LCM of two 8-bit numbers.


Two 8-bit numbers are stored at location 9000&9001, GCD at location 9002 & LCM At location 9003

ADDRESS
8000
8003
8004
8005
8006
8007
8008
800B
800D
800F
8010
8011
8012
8014
8015
8016
8017
8000
8000
8000
8000
8000
8000
8000
8000
8000

LABEL

Department of Electronics & Communication

MNEUMONIC
MOV DPTR,#9000H
MOVX A,@DPTR
MOV R0,A
NOP
INC DPTR
MOVX A,@DPTR
CJNE A,000H,NEXT(800D
SJMP AHEAD(8014)
JNC GO(8010)
XCH A,R1
CLR C
SUBB A,R0
SJMP BACK(8008)
INC DPTR
MOVX @DPTR,A
INC DPTR
MOV 0F0H,A
MOV 82H,#OOH
MOVX A,@DPTR
DIV AB
MOV OFOH,A
INC DPTR
MOVX A,@DPTR
MUL AB
MOV 82H,#03H
MOVX @DPTR,A
LCALL 0003

26

Sri Siddhartha Institute of Technology


7(a) Program to add multibyte numbers

ADDRESS
8000
8003
8005
8007
8009
800B
800C
800E
800F
8010
8012
8013
8014
8016
8017
8018
801A
801C
801E
801F

LABEL

Department of Electronics & Communication

MNEMONIC
MOV DPTR,#9000H
MOV R1,#04H
MOV R2,#90H
MOV R3,#91H
MOV R4,#92H
CLR C
MOV 83H,R2
MOVX A,@DPTR
MOV R5,A
MOV 83H,R3
MOVX A,@DPTR
ADDC A,R5
MOV 83H,R4
MOVX @DPTR,A
INC DPTR
DJNZ R1,800CH
JNC 801FH
MOV A,#01H
MOVX @DPTR,A
LCALL 0003

27

Sri Siddhartha Institute of Technology

7(b) program to subtract multibyte numbers


ADDRESS
8000
8003
8005
8007
8009
800B
800C
800E
800F
8010
8012
8013
8014
8016
8017
8018
801A
801C
801E
801F

LABEL

Department of Electronics & Communication

MNEMONIC
MOV DPTR,#9000H
MOV R1,#04H
MOV R2,#90H
MOV R3,#91H
MOV R4,#92H
CLR C
MOV 83H,R2
MOVX A,@DPTR
MOV R5,A
MOV 83H,R3
MOVX A,@DPTR
SUBB A,R5
MOV 83H,R4
MOVX @DPTR,A
INC DPTR
DJNZ R1,800CH
LCALL 0003H
MOV A,#01H
MOVX @DPTR,A
LCALL 0003

28

Sri Siddhartha Institute of Technology

8.Program to search the key element in the block of data and displays its position and its position number if
it is found, else display not found.

ADDRESS
8000
8003
8006
8008
800A
800B
800C
800D
800E
800F
8012
8014
8016
8019
801B
801C
801E
8021
8022
8025
8028

Department of Electronics & Communication

LABEL

MNEOMONIC
MOV 0DOH,#20H
MOV DPTR,#9000H
MOV R2,00H
MOV R1,#04H
MOVX A,@DPTR
MOV R0,A
INC DPTR
INC R2
MOVX A,@DPTR
CJNE A,00H,8014H
SJMP 801BH
DJNZ R1,800CH
MOV DPTR,#9500H
SJMP 8025H
MOV A,R2
ADD A,#30H
MOV DPTR,#940CH
MOVX @DPTR,A
MOV DPTR,#9400H
LCALL 164BH
LCALL 0003

29

Sri Siddhartha Institute of Technology

9. Program to sort the number in ascending order using bubble sort.


ADDRESS
8000
8003
8005
8007
8008
8009
800B
800C
800D
800E
800F
8010
8013
8015
8017
8018
801A
801B
801C
801D
801F
8020
8022
8024
8025
8027

LABEL

AGAIN

BACK

NEXT

AHEAD

Department of Electronics & Communication

MNEMONIC
MOV DPTR,#9000
MOV R1,#04H
PUSH 82H
MOV A,R1
MOV R4,A
MOV R2,82H
MOVX A,@DPTR
MOV R3,A
INC DPTR
INC R2
MOVX A,DPTR
CJNE A,03H,NEXT(8015)
SJMP AHEAD(8020)
JNC AHEAD
DEC R2
MOV 82H,R2
MOVX @DPTR,A
MOV A,R3
INC R2
MOV 82H,R2
MOVX @DPTR,A
DJNZ R4,BACK(800B)
POP 82H
NOP
DJNZ R1,AGAIN(8005)
LCALL 0003

30

Sri Siddhartha Institute of Technology


VISVESHWARAIAH TECHNOLOGICAL UNIVERSITY, BELGAUM
Branch: EC
Subject code: EC6L2
Subject title: Advanced microprocessor & Micro controller lab

Semester: VI

QUESTION BANK
Instructions:
1.Experiments on micro controller can be carried out using any 8-bit/16-bit micro controller kit.
2.A student should be given only one question either from part-1 or from part-II for the examination.
3.For each batch in examination, around 60% of the questions should be from part-I and around 40% of the questions should be from part-II.
4.No change of experiment/question is permitted in the examination.
PART-I
1.Write an ALP to transfer a given block of data (byte/word) from source memory block to destination memory block with or without overlapping.
2. Write an ALP to transfer given source string to destination using string instructions.
3.Write an ALP to perform the following string operations:
a) Reverse a string, search/delete a word from a string
b) Check if the given string is palindrome or not.
4.Write an ALP to add 16 bytes/words and find the average and display.
5.write an ALP to multiply two 32 bit numbers and display.
6.Write an ALP to multiply two ASCII byte numbers and display.
7.Develop and execute an ALP to find GCF/LCM of two 16-bit unsigned integers.
8.Develop and execute an ALP to sort a given set of 16-bit unsigned integers into ascending order using insertion/bubble sort algorithm.
9.Write an ALP to generate 10 fibonacci numbers, Read initial values via keyboard.
10.Write an Alp to generate prime numbers between 1 to 50 BCD.
11.Write an ALP to multiply two matrices &display.
12.Write an ALP to find
a) Sum of principal diagonal elements (trace of a matrix)
b) Norms of the matrix (sum of the squares of the principal diagonal elements)
13.Develop and execute an ALP that implements binary search algorithm. Assume that the data consist of sorted 16-bit integers. Search key is also a 16-bit
unsigned integer.
14.Interface a logic controller via 8255 using I/O cards and perform the following operations.
Read all the 8 inputs from the logic controller. Complement and display on the outputs.
PART-II
15.Write an Alp to transfer a block of data from a given source to destination using 8051/equivalent.
16.Writ an ALP to find average of 10 data bytes in a memory using 8051/equivalent.
17.Write an ALP to multiply 16bit by 8-bit data using micro controller.
18 Write an ALP to generate 10 fibonacci numbers using 8051/equivalent.
19.Interface a printer to 8051/equivalent to operate in
a) Handshake mode
b) Interrupt driven mode
20.Develop and execute an ALP to find GCF/LCM of two 8-bit numbers using 8051/equivalent.
21.Write an ALP to add/subtract two multibyte numbers using micro controller.
22.Write an ALP to search a given key element from an array of integers using 8051/equivalent.
23.Write an ALP to sort an array using bubble sort. Display the sorted array.
24.Write an ALP to interchange two blocks of data residing at memory using 8051/equivalent.

Department of Electronics & Communication

31

Operation Code-Sheet
Mnemonic
ACI
8-bit
ADC
A
ADC
B
ADC
C
ADC
D
ADC
E
ADC
H
ADC
L
ADC
M
ADD
A
ADD
B
ADD
C
ADD
D
ADD
E
ADD
H
ADD
L
ADD
M
ADI
8-bit
ANA
A
ANA
B
ANA
C
ANA
D
ANA
E
ANA
H
ANA
L
ANA
M
ANI
8-bit
CALL
16-bit
CC
16-bit
CM
16-bit
CMA
CMC
CMP
A
CMP
B
CMP
C
CMP
D
CMP
E
CMP
H
CMP
L
CMP
M
CNC
16-bit
CNZ
16-bit
CP
16-bit
CPE
16-bit
CPI
8-bit
CPO
16-bit
CZ
16-bit
DAA
DAD
B
DAD
D
DAD
H
DAD
SP
DCR
A
DCR
B
DCR
C
DCR
D
DCR
E
DCR
H
DCR
L
DCR
M
DCX
B
DCX
D
DCX
H

Hex
CE
8F
88
89
8A
8B
8C
8D
8E
87
80
81
82
83
84
85
86
C6
A7
A0
A1
A2
A3
A4
A5
A6
E6
CD
DC
FC
2F
3F
BF
B8
B9
BA
BB
BC
BD
BE
D4
C4
F4
EC
FE
E4
CC
27
09
19
29
39
3D
05
0D
15
1D
25
2D
35
0B
1B
2B

Mnemonic
DCX
SP
DI
EI
HLT
IN
8-bit
INR
A
INR
B
INR
C
INR
D
INR
E
INR
H
INR
L
INR
M
INX
B
INX
D
INX
H
INX
SP
JC
16-bit
JM
16-bit
JMP
16-bit
JNC
16-bit
JNZ
16-bit
JP
16-bit
JPE
16-bit
JPO
16-bit
JZ
16-bit
LDA
16-bit
LDAX
B
LDAX
D
LHLD
16-bit
LXI
B, 16-bit
LXI
D, 16-bit
LXI
H, 16-bit
LXI
SP, 16-bit
MOV
A, A
MOV
A, B
MOV
A, C
MOV
A, D
MOV
A, E
MOV
A, H
MOV
A, L
MOV
A, M
MOV
B, A
MOV
B, B
MOV
B, C
MOV
B, D
MOV
B, E
MOV
B, H
MOV
B, L
MOV
B, M
MOV
C, A
MOV
C, B
MOV
C, C
MOV
C, D
MOV
C, E
MOV
C, H
MOV
C, L
MOV
C, M
MOV
D, A
MOV
D, B
MOV
D, C
MOV
D, D
MOV
D, E

Department of E & C

Hex
3B
F3
FB
76
DB
3C
04
0C
14
1C
24
2C
34
03
13
23
33
DA
FA
C3
D2
C2
F2
EA
E2
CA
3A
0A
1A
2A
01
11
21
31
7F
78
79
7A
7B
7C
7D
7E
47
40
41
42
43
44
45
46
4F
48
49
4A
4B
4C
4D
4E
57
50
51
52
53

Mnemonic
MOV
D, H
MOV
D, L
MOV
D, M
MOV
E, A
MOV
E, B
MOV
E, C
MOV
E, D
MOV
E, E
MOV
E, H
MOV
E, L
MOV
E, M
MOV
H, A
MOV
H, B
MOV
H, C
MOV
H, D
MOV
H, E
MOV
H, H
MOV
H, L
MOV
H, M
MOV
L, A
MOV
L, B
MOV
L, C
MOV
L, D
MOV
L, E
MOV
L, H
MOV
L, L
MOV
L, M
MOV
M, A
MOV
M, B
MOV
M, C
MOV
M, D
MOV
M, E
MOV
M, H
MOV
M, L
MVI
A, 8-bit
MVI
B, 8-bit
MVI
C, 8-bit
MVI
D, 8-bit
MVI
E, 8-bit
MVI
H, 8-bit
MVI
L, 8-bit
MVI
M, 8-bit
NOP
ORA
A
ORA
B
ORA
C
ORA
D
ORA
E
ORA
H
ORA
L
ORA
M
ORI
8-bit
OUT
8-bit
PCHL
POP
B
POP
D
POP
H
POP
PSW
PUSH
B
PUSH
D
PUSH
H
PUSH
PSW
RAL

Hex
54
55
56
5F
58
59
5A
5B
5C
5D
5E
67
60
61
62
63
64
65
66
6F
68
69
6A
6B
6C
6D
6E
77
70
71
72
73
74
75
3E
06
0E
16
1E
26
2E
36
00
B7
B0
B1
B2
B3
B4
B5
B6
F6
D3
E9
C1
D1
E1
F1
C5
D5
E5
F5
17

Mnemonic
Hex
RAR
1F
RC
D8
RET
C9
RIM
C2
RLC
07
RM
F8
RNC
D0
RNZ
C0
RP
F0
RPE
E8
RPO
E0
RRC
0F
RST
0
C7
RST
1
CF
RST
2
D7
RST
3
DF
RST
4
E7
RST
5
EF
RST
6
F7
RST
7
FF
RZ
C8
SBB
A
9F
SBB
B
98
SBB
C
99
SBB
D
9A
SBB
E
9B
SBB
H
9C
SBB
L
9D
SBB
M
9E
SBI
8-bit
DE
SHLD
16-bit
22
SIM
30
SPHL
F9
STA
16-bit
32
STAX
B
02
STAX
D
12
STC
37
SUB
A
97
SUB
B
90
SUB
C
91
SUB
D
92
SUB
E
93
SUB
H
94
SUB
L
95
SUB
M
96
SUI
8-bit
D6
XCHG
EB
XRA
A
AF
XRA
B
A8
XRA
C
A9
XRA
D
AA
XRA
E
AB
XRA
H
AC
XRA
L
AD
XRA
M
AE
XRI
8-bit
EE
XTHL
E3
UPDAD
06BF
UPDDT
06D6

SSIT

Вам также может понравиться