This is a multi-part message in MIME format. ------=_NextPart_000_0019_01C69C58.D1316C10 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit Kevin wrote: > Yes, what is meant by two poles ? In this context, a pole means a single simple filter. In analog, one RC creates a single pole. A simple iterative equation for a single pole low pass filter is FILT <-- FILT + FF(NEW - FILT) where FILT is the filter output value, NEW is the filter input value this iteration, and FF is an adjustment factor intended to range between 0 (infinitely heavy filter, output never changes) to 1 (no filtering at all, output follows input). The nice thing about this equation is that it's easy to compute, especially when FF is 1 / 2**N where N is an integer. In other words, FF could be 1/4, 1/8, 1/16, etc. In those cases, the multiply by FF can be performed by a right shift of N bits. This type of filter is the same as a RC low pass filter in the analog domain. Just like you can use several RC filters in series, you can use several of these digital filters in series. Each one of the operations described by this equation is a pole. This is like connecting the output of one RC low pass filter to the input of another with a buffer amp in between. For example, a two pole digital low pass filter based on the above equation is: FILT1 <-- FILT1 + FF1(NEW - FILT1) FILT2 <-- FILT2 + FF2(FILT1 - FILT2) The overall input is NEW and the output FILT2. >> By shifting 8 bits? > I understand how to shift 8 bits, but why ? I was referring to the right shift to realize the multiply by FF. Using a shift value of 8 bits means FF = 1/256. > Normally, I would take 50 10bit adc readings, add them and > then divied by 50 to get an average result. That takes a lot of memory and cycles. At the very least it would be better to average 32 or 64 readings. The expensive divide by the number of readings then becomes just an inexpensive right shift. This type of filter is called a box filter. It's not that great in terms of frequency response, random noise attenuation compared to the filter I described above. > What is settling time ? I was referring to the settling time, or step response time of the filter. If everything starts out at zero, then you change the input instantaneously to 1, how fast will the output follow? Since it is an exponential approaching 1, it is not meaningful to ask how long it takes to get to 1. However, you can talk about how long it takes to get various fractions of the way there. I use my FILTBITS or PLOTFILT programs to show me the step response of filters given the FF values for each pole. Actually the command line values are in bits of shift rather than FF directly. I have attached a step response plot of two poles each with 8 shift bits (FF = 1/256 for each pole). From this you can see that this filter settles to about 90% in 1000 iterations. > Yes How is 93% arrived at and what is it's significance? >From the plot you can see that the filter reaches about 93% of its final value at 1100 iterations. > Why shifting by 8 bits is particularly trivial? > I assume it has something to do with a bit mask, > Or is achieved by a single instruction ? No, it's because the machine addresses memory in 8 bit chunks called bytes. Therefore there is no need to "shift" a value right 8 bits, you just read it starting 1 byte into it. > Why is 2 x 8 bits a lot of random noise attenuations? Look at what happens when NEW in the top equation has a glitch one iteration. FF of that glitch will make it to the output. For two poles, FF1*FF2 of the glitch will make it to the output. If you express the FF values in terms of the bits shifted, then the glitch is attenuated by 2**N where N is the sum of all the shift bits for all the poles. Two poles of 8 shift bits each (FF1 = FF2 = 1/256) attenuates a glitch, or any random noise, by 16 bits or 1/65536. ------=_NextPart_000_0019_01C69C58.D1316C10 Content-Type: image/gif; name="x.gif" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="x.gif" R0lGODlh9AGQAfcAMQAAAAAAQAAAgAAAwAAA/wAkAAAkQAAkgAAkwAAk/wBJAABJQABJgABJwABJ /wBtAABtQABtgABtwABt/wCSAACSQACSgACSwACS/wC2AAC2QAC2gAC2wAC2/wDbAADbQADbgADb wADb/wD/AAD/QAD/gAD/wAD//zMAADMAQDMAgDMAwDMA/zMkADMkQDMkgDMkwDMk/zNJADNJQDNJ gDNJwDNJ/zNtADNtQDNtgDNtwDNt/zOSADOSQDOSgDOSwDOS/zO2ADO2QDO2gDO2wDO2/zPbADPb QDPbgDPbwDPb/zP/ADP/QDP/gDP/wDP//2YAAGYAQGYAgGYAwGYA/2YkAGYkQGYkgGYkwGYk/2ZJ AGZJQGZJgGZJwGZJ/2ZtAGZtQGZtgGZtwGZt/2aSAGaSQGaSgGaSwGaS/2a2AGa2QGa2gGa2wGa2 /2bbAGbbQGbbgGbbwGbb/2b/AGb/QGb/gGb/wGb//5kAAJkAQJkAgJkAwJkA/5kkAJkkQJkkgJkk wJkk/5lJAJlJQJlJgJlJwJlJ/5ltAJltQJltgJltwJlt/5mSAJmSQJmSgJmSwJmS/5m2AJm2QJm2 gJm2wJm2/5nbAJnbQ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xCc8khldgtKajEDHLkV8t2zLUxZ2n61dM5zdO07dO1PcRAvXQ4O9kGUdnm49khAdri G7N57dviY9qh69S0waxvfXthjdlXOSJYfXTOfdmnjdcNwdkwzdVWZtBc/0WByM3H3o0kxu2Qz33d c82AXXfeyY3dUKfd253KKzjeA1HeEsvdbrbYCJGxJGjd7Z3e2X1w/i3e+m0QpM1twA1drS0sWgPG LLWE4U3JcazCPQrY5sneBG6CFG4ihx3cGC7hZ/nFGj098F08CW7eCw6v+gcWP3XTsv3itw3jtj3j sw1Iuf163rfCeVPiHGHI34HIJ/vUAZ6HAw7i0e0i08wQPC49J27Z8szg0p2VC9HhDRThqlzgVD7Y RX7l7j1DWf7ZH87lAF4Q9g1DTc5ahP0fXvHlVY7feamdCG2QrP3kkU3eHzfnM62nBg6aZ97jab6a CFHm7evmkqaw/E3kj/8Ny8G5f6HSmsEU52WN50ft2uhhRa5x6HzY559K59LEfNPLEhZef1Y+30dj Sw9GHFqUhJJ+1pS+3OeHGoViJLI+67Re67Z+67ie67q+6x3T6tSaSgcb7CoSLdMr7MY+mpvRIEyE srOUMQ1+kM6+ueEcZxNZ7cR5sX/BqCXiL72SG9oSiLoSNN/O7SMesOUe0e6ywX6726dOvevu6U17 7CqKdQrX7k9mMenO28GKHJvy6u7OpeeOwvYurQMf8HLqLAMv70Sq4/cD7v8OpbuNHfr+7oqR8ApP IfTu7x2n6A6/8dCd70j+8Nc+8S3JqMx82iZf7Ir9L5Z+8fwOdiIa7V+GZpnPLtnsjClAaPMuH+xQ 2es7//NAH/RCP/REX/RGf/RIT4kUfpfjm/ROD4koc/JPP/UFHPVUf/U3ZLEldnrPQmJY//VBnfL+ oezeBfZmj+Pj0+9jH+9Sf/Zuj/DwPqFsT/Jvf/Ysv/YFo/J1v/cAKlNqb/O09Pc3zveEX/iGf/iI n/gSEhAAOw== ------=_NextPart_000_0019_01C69C58.D1316C10 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist ------=_NextPart_000_0019_01C69C58.D1316C10-- ****************************************************************** Embed Inc, Littleton Massachusetts, (978) 742-9014. #1 PIC consultant in 2004 program year. http://www.embedinc.com/products