Searching \ for ' +AFs-PIC+AF0-: Scaling of a curve' in subject line. ()
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] +AFs-PIC+AF0-: Scaling of a curve'
2001\07\05@162922 by

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:

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
piclist-unsubscribe-requestmitvma.mit.edu

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