Searching \ for ' +AFs-PIC+AF0-: Scaling of a curve' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Scaling of a curve'.

No exact or substring matches. trying for part
PICList Thread
'[PICLIST] +AFs-PIC+AF0-: Scaling of a curve'
2001\07\05@162922 by Lawrence Lile

flavicon
face
part 1 3644 bytes content-type:text/plain; (decoded 7bit)

I have a piece of C code that does piecewise linearization of an analog
input, for a thermistor curve which is plenty nonlinear.  You can look at it
if you'd like.

It's not plug-and-play, you'll have to mess around with it a lot.  Here's
the basic theory:'

1.  Use Excel or Mathcad to generate a table of the desired number of steps.
I used an array of 16 rows by 2 columns, of two-byte longs.  Each number in
the first column maps an analog input to a corresponding output in the
second column.  Or, in plain english, Column 1 is the inputs, Column 2 is
the corresponding outputs.

2.  Your code then indexes through the table until the raw data from the A/D
is greater than the number in Column 1.  Keep track of the index number
here.

3.  Linear interpolate by looking up the numbers corresponding to
(index -1), and (index +- 1), thus:


A +AD0- Table+AFs-0+AF0AWw-Index-1+AF0AOw-
B +AD0- Table+AFs-0+AF0AWw-Index-1+AF0AOw-
C +AD0- Table+AFs-1+AF0AWw-Index-1+AF0AOw-
D +AD0- Table+AFs-1+AF0AWw-Index+AF0AOw-

Result1 +AD0- (rawdata - A) +ACo- (D - C) / (B - A) +- C+ADs-  // interpolate into the
table

4.  Believe me, all those diehards that think C is for wimps would have a
fun time coding a two dimensional lookup table of two byte longs in ASM.  Do
this in C.

5. Anybody who has coded a two byte two dimensional lookup table in ASM in
the last 5 years, lemme know, I'll buy you a free beer when you are in my
town.

-- Lawrence Lile

{Original Message removed}
part 2 11593 bytes content-type:application/octet-stream; (decode)

part 3 105 bytes
--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...