Upload
raghunath-beehech
View
1.191
Download
23
Embed Size (px)
Citation preview
7/26/2019 Smallest number 8051 program
1/1
; This program is used to find the largest element in the array.
Array starts from location 0x30
30h - 0x20
31h - 0x30
32h - 0x50
33h - 0x40
34h - 0x10
Largest element R3 - 10
; In 8051 we donot have simple compare instruction, at first the numbers are checked for equality if both the elements inthe array are equalno task is performed.
; "cjne" instruction is used to check for equality of both the numbers i.e. "cjne a,directaddr.,location"; First element is copied to R3 & second element to R4, initially the value in R3 is assumed as smallest and it is compared with next number in R4
; if R3 < R4 yes: continue comparing with next elements no: copy r4 to r3 and r3 is treated as smallest, comparing with next elementsdone
; repeat the compare operation untill the specified number of elements