Professional Documents
Culture Documents
1. Write an 8051 assemble program to fill the RAM location 22H-2BH with
even series.
org 0h
mov r0,#22h
mov a,#00h
mov r1,#0ah
loop:
mov @r0,a
add a,#02h
inc r0
djnz r1,loop
end
2.Write an 8051 assemble program to read the MYDATA from ROM location
300H and out put the same on the PORT-0. MYDATA has the string “
WELOCME TO 8051 ADDRESSING MODE”.
org 000
clr a
mov dptr,#count
movc a,@a+dptr
mov r1,a
mov dptr,#mydata
loop : clr a
movc a,@a+dptr
mov P0,a
inc dptr
djnz r1,loop
org 300h
mydata: db "welcome to jiitu!!!"
count: db $-str
end
3.Write an 8051 assemble program to read the MYDATA from ROM location
300H and move this data into RAM location starting from 30H. . MYDATA has
the string “DATA TRANSFER FROM ROM TO RAM”
org 000
clr a
mov dptr,#count
movc a,@a+dptr
mov r1,a
mov r0,#30h
mov dptr,#str
loop : clr a
movc a,@a+dptr
mov @ro,a
inc ro
inc dptr
djnz r1,loop
org 300h
str: db "data transfer from rom to ram!!!"
count: db $-str
end
org 000h
clr a
mov dptr,#count
movc a,@a+dptr
mov r1,a
mov r0,#50h
mov dptr,#str
loop : clr a
movc a,@a+dptr
mov @r0,a
inc r0
inc dptr
djnz r1,loop
clr a
mov dptr,#count
movc a,@a+dptr
mov r1,a
mov a,r1
mov b,#2h
div ab
mov r3,a
mov r0,#50h
dec r1
loop1:
mov a,r1
add a,#50h
mov b,r1
mov r1,a
mov a,@r1
mov r1,b
subb a,@r0
jnz tnot
inc r0
dec r1
djnz r3,loop1
mov r0,#30h
mov dptr,#str1
pallin:
clr a
movc a,@a+dptr
mov @r0,a
inc r0
inc dptr
cjne a,#00h,pallin
jmp exit
org 300h
str: db "madam"
count: db $-str
str1: db "Palindrome",0
str2: db "Not palindrome",0
end