Lab 10: CLA Floating-Point FIR Filter
C2000 Microcontroller Workshop - Control Law Accelerator 10 - 21
Acquisition Buffer Size 50
DSP Data Type 16-bit unsigned integer
Sampling Rate (Hz) 50000
Start Address A AdcBufFiltered
Start Address B AdcBuf
Display Data Size 50
Time Display Unit
µs
17. The graphical display should show the filtered PWM waveform in the Dual Time A
display and the unfiltered waveform in the Dual Time B display. You should see that the
results match the previous lab exercise.
18. Fully halt the CPU (real-time mode) by using the Script function: Scripts
Realtime Emulation Control Full_Halt.
Change Task 1 to FIR Filter in Assembly
Previously, the initialization and filter tasks were implemented in C. In this part, we will not
be using the C implementation of the FIR filter located at Task 1 in ClaTasks_C.cla.
Instead, we will add ClaTasks.asm to the project and use the assembly implementation of
the FIR filter located at Task 1 in this file. The CLA setup code in Cla_10.c and the filter
initialization C-code located at Task 8 in ClaTasks_C.cla will not need to change.
19. Switch to the “CCS Edit Perspective” view by clicking the CCS Edit icon in the upper
right-hand corner. Open ClaTasks_C.cla and at the beginning of Task 1 change the
#if preprocessor directive from 1 to 0. The sections of code between the #if and #endif
will not be compiled. This has the same effect as commenting out this code. We need to
do this to avoid a conflict with the Task 1 in ClaTask.asm file.
20. Add ClaTasks.asm to project from C:\C28x\Labs\Lab10\Files.
21. Open ClaTasks.asm and notice that the .cdecls directive is being used to include the
C header file in the CLA assembly file. Therefore, we can use the Peripheral Register
Header File references in the CLA assembly code. Next, notice Task 1 has been
configured to run an FIR filter. Within this code special instructions have been used to
convert the ADC result integer (i.e. the filter input) to floating-point and the floating-
point filter output back to integer. Notice at Task 2 the assembly preprocessor .if
directive is set to 0. The assembly preprocessor .endif directive is located at the end of
Task 8. With this setting, Tasks 2 through 8 will not be assembled, again avoiding a
conflict with Task 2 through 8 in the ClaTasks_C.cla file. Save and close all
modified files.