Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory Icdt 97 6th International Conference Delphi Greece January 8 10 1997 Proceedings Lncs 1186

Authors: Foto N. Afrati ,Phokion G. Kolaitis

1st Edition

3540622225, 978-3540622222

More Books

Students also viewed these Databases questions

Question

a. When did your ancestors come to the United States?

Answered: 1 week ago

Question

d. What language(s) did they speak?

Answered: 1 week ago

Question

e. What difficulties did they encounter?

Answered: 1 week ago