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 ix.netcom.com). ; Optimized by Dmitry A. Kiryashov (zews at aha.ru) 06/18/2000 ; 12 clocks/words Filter: mov W, AVE sub NEW, W ;NEW - AVE mov W, <>NEW and W, #$0F ;get /16 int part sb C ;result is neg? or W, #$F0 ;yes add AVE, W mov W, <>NEW and W, #$F0 ;get /16 frac part add AVFRAC, W snb C inc AVE ; ; low nibble of AVFRAC isn't used ; so we can utilize it for other purposes ;)
file: /Techref/scenix/lib/math/dsp/av-16w-dk_sx.htm, 1KB, , updated: 2004/6/10 14:40, local time: 2024/10/7 11:17,
44.220.251.236:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©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? <A HREF="http://www.piclist.com/techref/scenix/lib/math/dsp/av-16w-dk_sx.htm"> SX Microcontroller DSP Math Method 8bit 16 step Averageing filter by Dmitry</A> |
Did you find what you needed? |
PICList 2024 contributors:
o List host: MIT, Site host massmind.org, 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 www.piclist.com! |
.