0% found this document useful (0 votes)
51 views1 page

Programa 21

The document describes an algorithm to find the maximum number in an array of 10 numbers. It initializes a counter to 10 and a pointer to the first number in the array. It then compares each number to the running maximum, updating the maximum if a larger number is found. After comparing all numbers, it stores the final maximum number in memory location E000H. The algorithm is presented step-by-step and a flowchart and sample program in 8085 assembly language are provided.

Uploaded by

manpreet kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views1 page

Programa 21

The document describes an algorithm to find the maximum number in an array of 10 numbers. It initializes a counter to 10 and a pointer to the first number in the array. It then compares each number to the running maximum, updating the maximum if a larger number is found. After comparing all numbers, it stores the final maximum number in memory location E000H. The algorithm is presented step-by-step and a flowchart and sample program in 8085 assembly language are provided.

Uploaded by

manpreet kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Microprocessor 8085

Appendix A

Explanation :

For example : we have an array of 10 numbers. So we


initialize the counter with 10. Also we initialize a
pointer to point these numbers.
Compare first number with initial maximum number
i.e. zero. If number > maximum number, save number
otherwise increment pointer to compare next number.
Decrement counter, compare till all the numbers are
compared. Store the maximum number in memory
location E000 H.
Algorithm :
Step I
: Initialize pointer.
Step II : Initialize counter.
Step III : Initialize maximum number =0
Step IV : Compare number with maximum.
If no carry i.e. if number is smaller dont
interchange then goto step VI
Step V
: Save the maximum number.
Step VI : Decrement counter.
Step VII : Increment pointer.
Step VIII : Check if count = 0. If not goto step IV.
Step IX : Store the maximum number.
Step X
: Stop.

Flowchart : Refer flowchart 23.

Program :
Instruction

LDA D000H
MOV
C, A
XRA A
;
;
LXI H, D001H
BACK: CMP M
;
JNC SKIP
MOV
A, M
;
SKIP: INX H
DCR C
JNZ BACK
STA E000H
;
HLT
;

Comment
; Initialize counter
Maximum = Minimum
possible value = 0
; Initialize pointer
Is number > maximum
Flowchart 23
; If number > maximum then
interchange.

Store maximum number


Terminate program execution

You might also like