> David's "tutorial" seems quite complete and succinct to me. > No necessary steps and complications, and it goes directly to > the target: > > > > Vout(t) = Q(t)/C ; output voltage > > > i(t) = (Vin(t) - Vout(t) ) / R ; current through resistor into > > > capacitor > > > Q(t+h) = Q(t) + h*i(t) ; next count is the old count plus however > > > many new electrons came in (or out) over that time increment. > > IMO this can be understood by everybody with minimal analog > knowledge, as the basic concepts are simple: current through > a resistor, and charge in a capacitor, and how these relate > to the voltages across them. For me, that's close to perfect > as an introduction. From here to a program is a very small > step (as David also showed). This also can be very easily > implemented in a spreadsheet, with the associated graphs. > (FWIW, I'm sending one to you by > email.) > > And since this is the "right" thing (IMO, of course :), it > contains two hooks for further exploration: > 1- proper modeling with derivative equations (that's possibly > not the proper term...) and then solving these digitally, to > increase the "depth" > of understanding of this -- because it already presents one > result of this more theoretical approach in a simplified form, and > 2- the various forms of digital filter equations as they are > being used, to increase the knowledge about digital filter > applications -- because it ends up with one of the simplest > of them in exactly the form it is being used in "real" applications. Ok. I'm sure it is very nice. But you still haven't even seen the tutorial I'm working on. You are taking a different approach and I have to problem with that. I didn't ask for a critiqe of the tutorial, just for help with the integer math. You haven't even seen the tutorial and are commenting only on the code that is a result of it without reading the actual thing. I wish I could post it, but it is being sold, so I can only send it to you if you promise not to send it to anyone else. Please don't continue to assume it is "wrong" until you have seen it. Please understand that I agree your approach is probably fine, but it isn't a complete tutorial and therefore isn't really compareable. I would love to see you write a complete tutorial. --- James. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist