please dont rip this site

PIC Microcontoller DSP Math Method

8bit 16 step Averageing filter by Dmitry Kiryashov [zews at AHA.RU]

Hi Andrew.

I got some time and tried to rewrite your filter code to optimize it a little bit.

The formula can be rewritten as: Ave' = Ave + ( New - Ave )/16 ;

Used the same names for variables. TEMP cell isn't used.

I having more and more believing that 12 is some magical number for small completed code fragments. ;)

;       Initially written by Andrew Warren (fastfwd at
;       Optimized by Dmitry A. Kiryashov (zews at 06/18/2000
;       12 clocks/words

        movfw   AVE
        subwf   NEW,F   ;NEW - AVE

        swapf   NEW,W
        andlw   0x0F    ;get /16 int part
        skpc            ;result is neg?
        iorlw   0xF0    ;yes
        addwf   AVE,F

        swapf   NEW,W
        andlw   0xF0    ;get /16 frac part
        addwf   AVFRAC,F
        incf    AVE,F
;       low nibble of AVFRAC isn't used
;       so we can utilize it for other purposes ;)

See also:


file: /Techref/microchip/dsp/av-16w-dk.htm, 2KB, , updated: 2010/3/16 08:25, local time: 2024/6/22 06:30,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> PIC Microcontoller DSP Math Method 8bit 16 step Averageing filter by Dmitry</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!