Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 3 120ptsl Write a function Problem30 in AVR assembly to find the maximum

ID: 3817203 • Letter: P

Question

Problem 3 120ptsl Write a function Problem30 in AVR assembly to find the maximum number in an array For example, if an array A 10, 3, 49, 7, 251, the return value of Problem30 is 49 (Read ino and .h files carefully. Make sure your assembly code can make your whole project works) Note the array has already been defined in Examu Problem ino file,so you should directly use this array in Exami Problem3.ino #include "Exami Problem3.h" #include "avrio.h' uint8 t Maxima. extern uint8 t input arrayl10] {10,6,32,14,75, 108, 9,60,2,1); void setu Maxima Problem30: Serial begin(9600); Serial println(Maxima, DEC); void loopo ll-- Exami Problem3.h---------------- #include extern "C" uint8 t Problem30;

Explanation / Answer

Please take the reference of the below Assembly code

Largest number is an array:

DATA SEGMENT
ARR DB 10,6,32,14,75,108,9,60,2,1
LEN DW $-ARR
LARGE DB ?
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV AX,DATA
MOV DS,AX

LEA SI,ARR

MOV AL,ARR[SI]
MOV LARGE,AL

MOV CX,LEN
REPEAT:
MOV AL,ARR[SI]
CMP LARGE,AL
JG NOCHANGE

MOV LARGE,AL
NOCHANGE:
INC SI
LOOP REPEAT

MOV AH,4CH
INT 21H   
CODE ENDS
END START

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote