New Filter Component - How To Use?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

 Hi Everyone,

   

How do we go about using the new filter component? I would like to try the new filter component as follows:

   

1) 12 bit data input

   

2) Basic Hamming window FIR lowpass filter

   

12 bit sample data conceptual code:

   

//Global variables

   

int16 data[128] = {...};//Some array of input values that I will import from another program

   

int16 output[256];//Empty array that will hold the filter's output (big enough to account for size increase due to convolution)

   

uint16 i;//Counter for main loop

   

void main()

   

{

   

     Filter_Start();

   

     for(i = 0; i < 128; i++)

   

     {

   

          Filter_Write16(data);

   

          CyDelay(1);//Be sure that filter has finished its operation

   

          output = Filter_Read16();

   

     }

   

//Print the data to the test terminal upon completion

   

}

   

Is this the right way to go about using the filter? How do I choose the Readxx() function? Does the Read24() function give me the highest precision? Or will the Read16() be sufficent and scale properly?

   

Thanks!

0 Likes
1 Solution
Anonymous
Not applicable

 I'm intrested in this too. I think you might have to set the coherency register 1st. Unfortunatley, all of the code examples for this are down right now.

View solution in original post

0 Likes
2 Replies
Anonymous
Not applicable

 I'm intrested in this too. I think you might have to set the coherency register 1st. Unfortunatley, all of the code examples for this are down right now.

0 Likes
Anonymous
Not applicable

 I gave it a try with this code, and it seemed to work pretty well.

   

 

   

   

for(i = 0; i < IN_LEN; i++)

   

{

   

//Filter stuff

   

Filter_Write16(Filter_CHANNEL_A, input);

   

CyDelay(1);

   

output = Filter_Read16(Filter_CHANNEL_A);

   

   

//Take the filter's output and print to terminal via USB

   

sprintf(buffer, "%d,", output);

   

UART_PutString(buffer);

   

}