Hello

I am using ADuC7024. I am trying to implement a FIR filter whose coefficients are generated using MATLAB sptool. The coefficients are the following:

h[]= {-0.0111294364829681, -0.0250411871348976, 0.00634770026237138, 0.0217101096024431, -0.0373758385155041, 0.00697235792924841, 0.0637804820886267, -0.105287994376181, 0.00693697340286084, 0.546129280297772, 0.546129280297772, 0.00693697340286084, -0.105287994376181, 0.0637804820886267, 0.00697235792924841, -0.0373758385155041, 0.0217101096024431, 0.00634770026237138, -0.0250411871348976, -0.0111294364829681 } ; // filter coefficients

I am using float data type for the matrix "h".

In the filter implementation, I am multiplying the ADCDAT register with filter coefficients:

ADCDATA[] * h []

(where ADCDATA[] = (ADCDAT >>16))

In the above multiplication, h[] is float, so result is also float. Then I need to pass this result to DAC1DAT like this:

acc=acc+ h[]*ADCDATA[];

DAC1DAT= (acc << 16);

Like acc is float, then it is not possible to use the binary operand "<<"

Any idea of how to solve it?

One solution could be to convert h[] (coefficients of filter) into hexadecimal but is it possible ?, if yes then how ?

ADCDATA is of 2 Bytes so after conversion of h[], result should also be 2 bytes.

Thanks

Basically looks good - just check if for all calculations the "signed short" format is large enough, so that you don't lose information or get under-/overflows.

What problem do you see?