Question: Given the AVR Assembly program below written for the ATmega 3 2 8 PB microcontroller, fill in the program ( flash ) memory and data

Given the AVR Assembly program below written for the ATmega328PB microcontroller, fill in
the program (flash) memory and data memory with appropriate values by hand. For instructions,
list the instruction's mnemonic and replace labels, equates/definitions, functions and operations
in operands with their values in hexadecimal form. The first four instructions are entered to
get you started. For values written to locations in data memory, list the (potentially multiple)
values in hexadecimal form at the correct locations.
; define some constants
. EQU STARTVAL =3
. EQU ENDVAL =14
. EQUSTEP=4
; ensure Stack Pointer holds last address in SRAM
LDI R16, HIGH (RAMEND)
DUT SPH, R16
LDI R16, L.OW (R.AMEND)
DUT SPL, R16
; load conatanta into GPRa for use
LDI R16, STARTVAL.
LDI R17, STEP
LDI R18, ENDVAL.
PUSH R16 ; save R16's value on stack
RCALL SUMVALS ; call subroutine
POP R16 ; restore R16's value from stack
END: RJMP END ; infinite loop at program's end
; Subroutine repeatedly adds STEP (R17)
; to STARTVAL (R16) until the sum becomes
; larger than ENDVAL (R18). Answer that is
; less than or equal to ENDVAL will be held
; in R19.
SUMVAL.S :
MOV R19, R16 ; store current sum in R19
ADD R16, R17; add STEP to sum in R16
CP R18, R16 ; test if ENDVAL >= sum
BRPL SUMVALS ; loop again if ENDVAL sum
RET ; return from subroutine
 Given the AVR Assembly program below written for the ATmega328PB microcontroller,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!