Other Parts Discussed in Thread: C2000WARE, CONTROLSUITE
Hi All,
I have been messing around with the concept of applying some FIR digital filtering to the outputs of my ADC's as I need to have a very accurate and low-noise reading of the analogue input pin.
I already use task 1 and task 8 in my CLA to perform a 2P2Z controller calculation from the DCL library, and to initialize all the DCL variables, respectively.
I found the FIR32 example in C2000Ware, called: cla_adc_fir32_cpu01. This is an assembly language implementation of an FIR32 filter. Because it is wrote in assembly language, it is different to my current CLA format where I have what is a file with the extension ".cla".
I would like to know whether there is a way to combine these two types of CLA code into the one I already have wrote, where the DCL is called through functions and the assembly language is simply kept in the directory of the project and executes when the functions are called.
For example, should the following work:
__interrupt void Cla1Task7 ( void ) {
asm("fir32.asm");
}
My CLA7 is triggered by an ADCINT, but I am not sure whether this code is correct for entering the .asm file and executing it, placing the filtered voltage as an output. I planned to have one ".asm" file that actually executes the assembly file FIR32, and filters the voltage, and then creating a second ".asm" file that is for initialization of the filter coefficients and delays, and calling that in a separate CLA task as follows:
__interrupt void Cla1Task3 ( void ) {
asm"fir32_init.asm";
}
And just triggering this one via software in main() before the ISR's begin to ensure that the filter coefficients and delays are initialized before the program begins looping. I am thinking to do this because as it stands I have what is technically two CLA's (The one that holds the .asm, and my DCL CLA file) which may clash in memory if they are called at the same time -- really hope that makes sense.
As a side note, there are some other errors that I get with this code example:
MUI16TOF32 MR2, @_AdcaResultRegs.ADCRESULT0 ;8 Read ADCRESULT0 and convert to float
Throws the error E0009 - Missing struct/union member or tag and E0300 - The following symbols are undefined.
extern float X[FILTER_LEN]; // Filter sample delay line extern float A[FILTER_LEN]; // A - Filter Coefficients
Throws three errors:
#17 expected a "]"
#171 expected a declaration
#29 expected an expression
I put these in my CLA code where the DCL is held so it might be to do with that not being correct.
When I try to compile the code, the compiler actually doesn't seem to have an issue with me attempting to call assembly files from the CLA. No errors there whatsoever, so maybe that is correct?
If so, then would one define these variables and buffers in the normal way one would when communicating between the CLA and the CPU? Is there anything inherently wrong with this approach?
I am really confused how the "CLA" has been coded as an "ASM" file, that doesn't seem to make much sense. I've always seen a separate ".cla" file in the explorer when the CLA of the C2000 family of devices is used, but that does not seem to be the case here.
As a final note, I've had this problem for a long time now but again the linker command file for this project is completely missing from the files in C2000Ware I am looking at. I assume there needs to be a modification in my linker command file to define some additional memory in RAM for this assembly language file, but I cannot discern a thing without being able to look at it!
A complicated question, I know -- but any help or a push in the right direction with some documents/study material for why this example was coded the way it was would be more than appreciated.
Best regards,
Joel
File location: C:\ti\controlSUITE\device_support\F2837xD\v210\F2837xD_examples_Cpu1\cla_adc_fir32\cpu01
