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

part 1 3644 bytes contenttype: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 plugandplay, 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 twobyte 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+AFs0+AF0AWwIndex1+AF0AOw
B +AD0 Table+AFs0+AF0AWwIndex1+AF0AOw
C +AD0 Table+AFs1+AF0AWwIndex1+AF0AOw
D +AD0 Table+AFs1+AF0AWwIndex+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 contenttype:application/octetstream; (decode)
part 3 105 bytes

http://www.piclist.com hint: To leave the PICList
spam_OUTpiclistunsubscriberequestTakeThisOuTmitvma.mit.edu
More... (looser matching)
 Last day of these posts
 In 2001
, 2002 only
 Today
 New search...