OPTIONAL Lab C-C: Sum-of-Products in C
C - 22 C28x - Appendix C - Assembly Programming
OPTIONAL Lab C-C: Sum-of-Products in C
Objective
The objective of this lab is to practice and verify the mechanics of performing C programming
arithmetic on the TMS320C28x. The objective will be to add the code necessary to obtain the
sum of the products of the n-th values from each array.
Procedure
Create Project File
1. In Code Composer Studio create a new project called LabC-C.pjt in
C:\C28x\Labs\Appendix\LabC\LabC-C and add LabC-C.c, LabC-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 experiement and explore the various build
options when working with C.
Sum of Products using a MAC-based Implementation
2. Edit LabC-C.c and modify the “main” routine to perform a MAC-based
implementation in C. Since the MAC operation requires one array to be in program
memory, the initialization routine can skip the transfer of one of the arrays, thus reducing
the amount of data RAM and cycles required for initialization.
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, open memory windows to see the values located in table [9] and data
[9] . (Note: data[9] consists of the allocated arrays of data, coeff, and result). Open the
CPU Registers. Check to see if the program is working as expected. Debug and modify,
if needed.
End of Exercise