OPTIONAL Lab B-C: Array Initialization in C
OPTIONAL Lab B-C: Array Initialization in C
Objective
The objective of this lab is to practice and verify the mechanics of initialization using C.
Additionally, we learn how to run and observe the operation of C code using Code Composer
Studio. In this lab, we will initialize the
“vars”
arrays with the contents of the
“const”
table.
Procedure
Create Project File
1. In Code Composer Studio create a new project called
LabB-C.pjt
in
C:\C28x\Labs\Appendix\LabB\LabB-C
and add
LabB-C.c
,
LabB-C.cmd
and
C:\ti\c2000\cgtools\lib\rts2800_ml.lib
to it. Check your file list to make
sure all the files are there.
Do not
setup any Build Options. The default values will be used.
In Appendix Lab D exercise, we will experiment and explore the various build options when
working with C.
Initialize Allocated RAM Array from ROM Initialization Table
2. Edit
LabB-C.c
and modify the “main” routine to copy
table[9]
to the allocated arrays of
data[4]
,
coeff[4]
, and
result[1]
. (Note:
data[9]
consists of the allocated arrays of
data
,
coeff
,
and
result
).
Build and Load
3. Click
the
“Rebuild All”
button and watch the tools run in the build window. Debug as
necessary.
Note:
Have Code Composer Studio automatically load the output file after a successful build. On
the menu bar click:
Option Customize…
and select the
“Program Load Options”
tab,
check “Load Program After Build”
, then click
OK
.
4. Under
Debug
on the menu bar click
“Go Main”
. Single-step your routine. While single-
stepping, it is helpful to see the values located in
table[9]
and
data[9]
at the same time. Open
two memory windows by using the
“View Memory”
button on the vertical toolbar and
using the address labels
table
and
data
.
Setting the properties filed to “Hex – TI style”
will give you more viewable data in the window. Additionally, you can watch the CPU (and
Status) registers. Open the CPU core and status registers by using the
“View CPU
Registers”
. Deselect
“Allow Docking”
and move/resize the window as needed.
Check to see if the program is working as expected.
End of Exercise
C28x - Appendix B - Addressing Modes
B - 17
Содержание C28 Series
Страница 64: ...Summary 3 16 C28x Peripheral Registers Header Files ...
Страница 78: ...Interrupt Sources 4 14 C28x Reset and Interrupts ...
Страница 218: ...Lab 9 DSP BIOS 9 22 C28x Using DSP BIOS ...
Страница 244: ...Lab 10 Programming the Flash 10 26 C28x System Design ...
Страница 273: ...Appendix A eZdsp F2812 C28x Appendix A eZdsp F2812 A 1 ...
Страница 275: ...Appendix eZdsp F2812 eZdsp F2812 Connector Header and Pin Diagram C28x Appendix A eZdsp F2812 A 3 ...
Страница 276: ...Appendix P2 Expansion Interface A 4 C28x Appendix A eZdsp F2812 ...
Страница 277: ...Appendix P4 P8 P7 I O Interface C28x Appendix A eZdsp F2812 A 5 ...
Страница 278: ...Appendix A 6 C28x Appendix A eZdsp F2812 ...
Страница 279: ...Appendix P5 P9 Analog Interface C28x Appendix A eZdsp F2812 A 7 ...
Страница 281: ...Appendix JP7 JP8 JP11 JP12 Boot Mode Select JP9 PLL Disable DS1 DS2 LEDs C28x Appendix A eZdsp F2812 A 9 ...
Страница 282: ...Appendix A 10 C28x Appendix A eZdsp F2812 TP1 TP2 Test Points ...