Lab B: Addressing
Lab B: Addressing
Objective
The objective of this lab is to practice and verify the mechanics of addressing. In this process we
will expand upon the
ASM
file from the previous lab to include new functions. Additionally, we
learn how to run and observe the operation of code using Code Composer Studio.
In this lab, we will initialize the
“vars”
arrays allocated in the previous lab with the contents of
the
“const”
table. How is this best accomplished? Consider the process of loading the first
“const”
value into the accumulator and then storing this value to the first
“vars”
location,
and repeating this process for each of the succeeding values.
•
What forms of addressing could be used for this purpose?
•
Which addressing mode would be best in this case? Why?
•
What problems could arise with using another mode?
Procedure
Copy Files, Create Project File
1. Create a new project called
LabB.pjt
in
C:\C28x\Labs\Appendix\LabB
and add
LabB.asm
, and
LabB.cmd
to it. Check your file list to make sure all the files are there.
Be sure to setup the Build Options by clicking:
Project Build Options
on the
menu bar. Select the Linker tab. In the middle of the screen select
“No
Autoinitialization”
under
“Autoinit Model:”
. Create a map file by typing
.\Debug\LabB.map
in the
Map Filename [-m]
field. Enter
start
in the
“Code Entry Point (-e):”
field. Next, select the Compiler tab. Note that
“Full
Symbolic Debug (-g)”
under
“Generate Debug Info:”
is selected. Then
select
OK
to save the Build Options.
Initialize Allocated RAM Array from ROM Initialization Table
2. Edit
LabB.asm
and modify it to copy
table[9]
to
data[9]
using indirect addressing. (Note:
data[9]
consists of the allocated arrays of
data
,
coeff
, and
result
). Initialize the allocated
RAM array from the ROM initialization table:
•
Delete the NOP operations from the
“code”
section.
•
Initialize pointers to the beginning of the
“const”
and
“vars”
arrays.
•
Transfer the first value from
“const”
to the
“vars”
array.
•
Repeat the process for all values to be initialized.
To perform the copy, consider using a load/store method via the accumulator. Which part of an
accumulator (low or high) should be used? Use the following when writing your copy routine:
-
use AR1 to hold the address of
table
-
use AR2 to hold the address of
data
3. It is good practice to trap the end of the program (i.e. use either
“end: B end,UNC”
or
“end: B start,UNC”
). Save your work.
C28x - Appendix B - Addressing Modes
B - 15
Summary of Contents for C28 Series
Page 64: ...Summary 3 16 C28x Peripheral Registers Header Files ...
Page 78: ...Interrupt Sources 4 14 C28x Reset and Interrupts ...
Page 218: ...Lab 9 DSP BIOS 9 22 C28x Using DSP BIOS ...
Page 244: ...Lab 10 Programming the Flash 10 26 C28x System Design ...
Page 273: ...Appendix A eZdsp F2812 C28x Appendix A eZdsp F2812 A 1 ...
Page 276: ...Appendix P2 Expansion Interface A 4 C28x Appendix A eZdsp F2812 ...
Page 277: ...Appendix P4 P8 P7 I O Interface C28x Appendix A eZdsp F2812 A 5 ...
Page 278: ...Appendix A 6 C28x Appendix A eZdsp F2812 ...
Page 279: ...Appendix P5 P9 Analog Interface C28x Appendix A eZdsp F2812 A 7 ...
Page 282: ...Appendix A 10 C28x Appendix A eZdsp F2812 TP1 TP2 Test Points ...