Hey cool -- some concrete math. I've been calculating to 4 bits to the right of the b.p. (binary point, which is my terminology for binary equivalent of a decimal point), and so far it's been quite accurate. I did some experiments with coming *up* to a certain value and going *down* to that value and it seems to settle back to the same point quite well (meaning the error is unnoticeable). I'm doing a bit of rounding as well. Cheers, -Neil. On Thursday 12 May 2005 12:22 pm, Spehro Pefhany scribbled: > This simulates a single-pole RC low pass filter with time constant > tau = Ts * (1/K - 1) (where Ts is sample period) > > So, if you want tau = 0.5 seconds and you are sampling 20 times a second > (Ts = 0.05) then you'd use K = 1/9 . > > The output never quite reaches the input (with infinite precision math), so > it's an IIR filter. With a step change the error after t time is > > % error = 100% * exp(-t/tau)). So with 0.5 second tau, after 5 tau (2.5 > seconds) > you'd have an error of about 0.7%. > > > > Best regards, > > Spehro Pefhany --"it's the network..." "The Journey is the > reward" speff@interlog.com Info for manufacturers: > http://www.trexon.com Embedded software/hardware/analog Info for > designers: http://www.speff.com Inexpensive test equipment & parts > http://search.ebay.com/_W0QQsassZspeff -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist