new ideas

The scaling code uses an itteration technique.

 

Using the concept circuit to explain the code.

We need to measure the position of the Pot, k.

We need to scale Vout = k VoutRef.

The Pot position k scales VinRef so Vmeas = k VinRef.

VinRef is subject to large errors, but there is no alternative. We have VinRef, and Vmeas in arbitary units measured by counting, subject to errors due to battery voltage, tolerence of C, and the Pot. We have to assume that the angle of the pot bar is proportional to A/(A+B) is accurate, and does not change from setting to setting.

Further Thoughts...

This itteration technique is powerfull as we can use it to compress a large value down to A Law.

A Law values are approximately formatted.

(sign, segment, value.) xor 0xAA

so the calculated value is 2^segment*value.

First find the segment, and then the value within the segment. The diagram on the left shows Vmeas as the thick read line, and the possible Vout.

To this end we could modify the concept code. If the Vmeas is within the segment then itterate the value using successive Approv

VinRef is subject to large errors, but there is no alternative. We have VinRef, and Vmeas in arbitary units measured by counting, subject to errors due to battery voltage, tolerence of C, and the Pot. We have to assume that the angle of the pot bar is proportional to A/(A+B) is accurate, and does not change from setting to setting.

 

This code needs more work on it.
VnextTry    := VinRef; 
VoutNextTry := VoutRef; 
Vitteration := 0;

For Segment:= 7 down to 0 do
BEGIN
  VnextTry := VinRef div 2
  {/* if Vmeas > VnextTry then Vmeas is in the segment */}
  if ( Vmeas > VnextTry ) then
  BEGIN
    { found it so now itterate the value }
    For precision := 0 to 8 do
    BEGIN
      VnextTry := VnextTry div 2;
      VoutNextTry := VoutNextTry div 2;

      ; Compare Vmeas against itteration

      if ( Vmeas => ( Vitteration+VnextTry )
      BEGIN
        Vitteration := Vitteration + VnextTry;
        Vout := Vout + VoutRef
      END
    END
  END
END

We now have Vout = k VoutRef .

first page...

Doug Rice, 13th July 2001.