Why do you care if it gets to 255 or just 254 ? The error is pretty small. Tal > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Edson Brusque (listas) > Sent: Thursday, June 13, 2002 4:54 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC]: Software low pass filtering > > > Hello All, > > > some months ago Olin posted the formula that changed DSP world: :) > Filt <-- Filt + (New - Filt)*FFrac > > Saddly, my 8 bit implementation have a problem that I can't surpass: > filt = filt + ((sig16)new - (sig16)filt) / 2; > > The value never goes to 255 because of integer roundings: > filt = 254 + (255 - 254) / 2; > filt = 254 + (1)/2; > filt = 254; > > There's a way to change this? I've tried to raise the > resolution making: > filt = filt + ((sig16)new*2 - (sig16)filt*2 + 1) / 4; > > But got same results because: > filt = 254 + ((sig16)255*2 - (sig16)254*2 + 1) / 4; > filt = 254 + (510 - 508 + 1) / 4; > filt = 254 + (510 - 508 + 1) / 4; > filt = 254 + (1) / 4; > > Please, someone help me!!! > > Best regards, > > Brusque > > ----------------------------------------------------------------- > Edson Brusque C.I.Tronics Lighting Designers Ltda > Research and Development Blumenau - SC - Brazil > Say NO to HTML mail www.citronics.com.br > ----------------------------------------------------------------- > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > > -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body