I am making Active Noise Cancellation system. And I made prototype control code. But I have a problem now.
When I operate this code, because of length of filter, Overhead is happened.
I command to my project operating 8khz. but my code operate 4khz.
------------------------------------------- here is my vector processing code --------------------------------------------------------
#define Length = 100
float A[Length];
float B[Length];
float C;
float D[Length];
-------------------------------------------- interrupt service routine --------------------------------------------------------------------
for ( i = Length-1; i >= 1; i -- )
{
A[i] = A[i-1];
}
A[0] = B;
// Normalization
Norm = 1.0f;
for ( i = Length-1 ; i >= 0 ; i-- )
{
Norm += A[i]*A[i];
}
// model output
for ( i = Length-1; i >= 0; i -- )
{
C += D[i]*A[i];
}
// Modeling error
error = yn_e[0] - Model_out;
//LMS algorithm
mu = 0.001f;
alpha = mu*error/Norm;
for ( i = Length-1; i >=0; i-- )
{
D[i] += alpha*A[i];
}
-------------------------------------- code end -----------------------------------------------------
This code have four 'for' loop. And these loop is organized serial.
I think that overhead is happened due to serial connection between 'for' loop.
Can you suggest to me some advice?