filter

Discussion in 'Programmer's Corner' started by strikefreedom, Apr 11, 2012.

  1. strikefreedom

    Thread Starter New Member

    Mar 31, 2012
    7
    0
    can i know what is the ' i ' inside this coding
    if i need to define it , how?
    Because i put it inside to another coding , is need to define the ' i '

    //Fir.c
    #include "bs2700.cof" //coefficient file BS @ 2700Hz
    int yn = 0; //initialize filter's output
    short dly[N]; //delay samples

    interrupt void c_int11() //ISR
    {
    short i;

    dly[0] = input_sample(); //new input @ beginning of buffer
    yn = 0; //initialize filter's output
    for (i = 0; i< N; i++)
    yn += (h * dly); //y(n) += h(i)* x(n-i)
    for (i = N-1; i > 0; i--) //starting @ end of buffer
    dly = dly[i-1]; //update delays with data move

    output_sample(yn >> 15); //scale output filter
    return;
    }

    anyone know it...
     
  2. panic mode

    Senior Member

    Oct 10, 2011
    1,320
    304
    it is defined:

    Code ( (Unknown Language)):
    1. short i;
    and it is used as loop counter

    Code ( (Unknown Language)):
    1. for (i = 0; i< N; i++)
    2. yn += (h[i] * dly[i]); //y(n) += h(i)* x(n-i)[/i][/i]


    and

    Code ( (Unknown Language)):
    1. for (i = N-1; i > 0; i--) //starting @ end of buffer
    2. dly[i] = dly[i-1]; //update delays with data move[/i]
     
Loading...