On 6/9/05, Todd Bailey wrote: > Friends, > > So I have this sticky analog design problem which I don't think should be > that complicated, but I just can't find a good reference for it. I suspect > the circuit I'm looking for is related to a diff amp with some kind of level > shifting, and I know this list is about microcontrollers, but I thought > maybe someone would know the answer to this question just offhand. > > It's especially annoying because I can't think of what the appropriate > name of this circuit would be. > > Here goes: > > The input to this mystery circuit has three slow-moving positive voltages > (essentially DC) which are all linear and floating. Voltage A, although > floating, will always be the highest of the three. Voltage B will always be > the lowest, and Voltage C will move around between the two over time. I > know somewhere out there is a circuit which takes those three inputs and > gives an output voltage which is proportional to the floating input voltage, > but over a fixed range (like a rail-to-rail supply). > For example: Voltage A is 1.5V, Voltage B is 1.0V, and Voltage C is 1.25V. > If the rails on the circuit are 5V and ground, the output would be 2.5V. It > would have exactly the same output (2.5V) if A, B, and C were, say, 1.2V, > 0.8V, and 1.0V, respectively. > Mathematically, your desired output voltage is (B-A)*5/(C-A) Subtracting A from B is easy. Scaling is harder. You need a variable gain device. If you are just going into a ADC, you can do A-B and 5*(C-A) in op-amps, then feed the A-B into the ADC with 5*(C-A) as the reference. This makes the ADC do the scaling. Regards, Mark markrages@gmail -- You think that it is a secret, but it never has been one. - fortune cookie -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist