; smallest element in a given string
; external memory
org 9000h
mov r3,#05h
mov dptr,#8000h
movx a,@dptr
mov r1,a
nextbyte: inc dptr
movx a,@dptr
clr c
mov r2,a
subb a,r1
jnc skip
mov a,r2
mov r1,a
skip: djnz r3,nextbyte
mov dpl,#62h
mov a,r1
movx @dptr,a
sjmp $
org 8000h
db 04,05,06,07,08,02
end
;Result: 8062 -> 02
Related topics:
8051 Program - largest element in an array | 8051 Program - factorial of a given number | 8051 Program - fibonacci series | 8051 Program - lcm of two numbers | 8051 Program - gcf of two numbers | 8051 Program - memory subroutines | 8051 Program - math subroutines | 8051 Program - conversion subroutines
List of topics: 8051
Thanks! It is really useful
ReplyDeleteThank you for help.. one question in my mind , how to write a program to find smallest number from memory block using 8051 uc by assembly language?
ReplyDelete