This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

store filter coefficients in a header file

I worked on a DSP project before where filter coefficients (coeffs) are listed in the header file (.h) as a single column. Then somehow it is loaded into a array (named BArray) in C/C++ programming, and operations on these coeffs are done based on this array (BArray). However, I couldn't remember how to load these coeffs in the header file into an array in C/C++. 

  • Hi Cindy,

    How are you generating the filter co-effs, matlab or some other tool ? In MATLAB they have a tool called fdatool that will allow you to create the header. that contains the coeffs in form of an array. you can then use the array with the DSPLIB FFT functions after putting it in the right format with/without scaling them.

    Regards,

    Rahul

  • If I store two sets of filter coefficients in the DSP memory (not necessarily in .h files), how could user access the memory to switch between the two sets of coeffs directly from the device for the filtering?

  • Depending on what device you will be using, you could use a h/w or software switch that the device can check to switch between the two sets. You could program the UARTs to send theuser input or touch display or plain push button. Some devices don`t use all of their boot switches in that case you can assign the value latched in from the switch to choose the coeffs(this will only allow you to select at boot time though)

    Regards,

    Rahul

  • The set of coefficients needs to be changed on the fly. The device is 6748. Is it a good idea if I put the coefficients into different .h files?

  • Cindy,

    If you have values in a header file, those values are being placed into an array by the compiler or C run-time environment by the definition of a header file, right? What else would it mean to have values in a header file? Unless the values are just numbers in a text file.

    const int16_t CoefA[4] = { 1, 2, 3, 4 };
    const int16_t CoefB[4] = { 5, 6, 7, 8 };

    What am I misunderstanding in your question?

    Regards,
    RandyP