# Digital filtering help?

#### martini1

Joined Apr 3, 2009
1
I think I've been using an IIR instead of an FIR to filter accelerometer readings in my embedded system. The reason being that...

The filtering routine takes a new ADC reading and stores it in element[0] of the filter storage array. Then it takes the previous 9 stored elements, adds them together with element[0] and copies the resulting average back into element[0]. So, when we re-enter the filter routine, to process the next new reading we are using previously filtered outputs.

Now, it is my belief that the difference between IIR and FIR is that IIR uses previously filtered outputs in the equation. Am I correct in thinking that I'm using an IIR? Any help?

Code:

Rich (BB code):
//Digital low pass filter to process X,Y and Z accel readings
{
Int8U i;    //Loop counter variable

//Shift values along to make room for new readings
for(i = 0; i < (MAX_FILTER_STORE - 1); i++)
{
pFilter[i + 1] = pFilter;
}
//Place the new reading in the first element
}