Assembly Robot Prelab 7 – Indirect Addressing (FLASH)

Introduction

The focus of this prelab is to help you understand the difference between indirect addressing with FLASH and indirect addressing with SRAM. These problems will also reinforce the base address + index concept as well as provide a few examples of the code structure.

Questions

1) What value is being loaded into the Z register based on the code given below? Assume the data table called measurement starts at 0x0148.

ldi ZH, high(measurement<<1)
ldi ZL, low(measurement<<1)

2) Write the code that will define the data table called output that has the following values stored: 0xA8, 0x83, 0x19, 0xE2, 0x6F. Make sure it is located at the address 0x018D in FLASH.

3) Using the information defined in problem 2, what value will be loaded into register 19 if the following code is executed?

ldi ZH, high(output<<1)
ldi ZL, low(output<<1)
ldi R18, 0x03
clr R19
add ZL, R18
adc ZH, R19
lpm R19, Z

4) Explain the purpose of the Z pointer register in regards to indirect addressing with FLASH. How is it different from the pointer registers used in indirect addressing with SRAM?

Prelab 7 Deliverable(s)

Page 1 - Title Page with Name, lab title, and photo

Page 2 - Answers to questions and completed tables