Searching \ for '[PIC] Looking to implement a correction table or o' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/memory.htm?key=table
Search entire site for: 'Looking to implement a correction table or o'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Looking to implement a correction table or o'
2006\01\25@092126 by Sean Schouten

face picon face
Hi!

I am looking at controlling the frequency of a wienbridge oscillator using a
digital potmeter. My problem being that digital logarithmic potmeters don't
come in anything > 256 steps. Because of that I have decided that I want to
add a "pad-resistor" that is connected to one end of the potentiometer and
the wiper, to *simulate*  a log taper. [ See
http://www.edn.com/article/CA46509.html ]. All I need to do is implement a
correction-table to *correct* any possible deviations from a logarithmic
scale, or that's my plan anyway!

Are there any better ways to make a correctional table other than using a
lookup table that *jumps*? I would like to be able to calculate the
correction on the fly and return the corrected value. Is that a good idea?
Any tips?

Thanks,

Sean

2006\01\25@094613 by olin piclist

face picon face
Sean Schouten wrote:
> Are there any better ways to make a correctional table other than using
> a lookup table that *jumps*?

Certainly.  A jumping lookup table for just a data (bunch of GOTO
instructions) is not a good idea.  At the very least on older parts you can
use a RETLW lookup table.  On many newer flash parts you can use table read
instructions to read program memory directly.  I believe this capability is
standard on all 16F and 30F parts.


******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products

2006\01\25@100933 by Wouter van Ooijen

face picon face
> On many newer flash parts you can
> use table read
> instructions to read program memory directly.  I believe this
> capability is
> standard on all 16F and 30F parts.

Standard on 18F and 30F AFAIK, also on some 16F, maybe even on some 12F.

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: http://www.voti.nl/hvu


2006\01\25@101200 by olin piclist

face picon face
Olin Lathrop wrote:
> Certainly.  A jumping lookup table for just a data (bunch of GOTO
> instructions) is not a good idea.  At the very least on older parts you
> can use a RETLW lookup table.  On many newer flash parts you can use
> table read instructions to read program memory directly.  I believe
> this capability is standard on all 16F and 30F parts.

Oops.  I meant to say it is standard on all **18**F parts.  Some 16F parts
do have this capability, but some do not.


******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products

2006\01\25@102359 by Mike Harrison

flavicon
face
On Wed, 25 Jan 2006 15:21:25 +0100, you wrote:

>Hi!
>
>I am looking at controlling the frequency of a wienbridge oscillator using a
>digital potmeter. My problem being that digital logarithmic potmeters don't
>come in anything > 256 steps. Because of that I have decided that I want to
>add a "pad-resistor" that is connected to one end of the potentiometer and
>the wiper, to *simulate*  a log taper. [ See
>http://www.edn.com/article/CA46509.html ]. All I need to do is implement a
>correction-table to *correct* any possible deviations from a logarithmic
>scale, or that's my plan anyway!
>
>Are there any better ways to make a correctional table other than using a
>lookup table that *jumps*? I would like to be able to calculate the
>correction on the fly and return the corrected value. Is that a good idea?
>Any tips?

You have to balance the space/time of the code used to calculate the answer against the space needed
for a lookup table.
For some functions, table size can be hugely reduced by simple linear interpolation between entries
- this works very well for things like PT100 and thermocouple linearisation which only require small
corrections, and the code is simple if you used fixed-point maths with the point at a multiple of 8
bits.
Excel is a useful tool to evaluate the errors from various table sizes, to determine the optimum
step size for the accuracy required.






2006\01\25@104059 by Alan B. Pearce

face picon face
>> Are there any better ways to make a correctional table
>> other than using a lookup table that *jumps*?
>
>Certainly.  A jumping lookup table for just a data (bunch
>of GOTO instructions) is not a good idea.  At the very least
>on older parts you can use a RETLW lookup table.

I did not take it that he meant using GOTO's as jumps, rather that a 64 step
table has discontinuous jumps (steps) in it.

The solution (to me) is to use RETLW or TABLRD (as appropriate), and do
software smoothing of the jumps between steps, to work out just what you
need.

2006\01\25@104414 by Harold Hallikainen

face picon face
You MIGHT be able to come up with a function that does the correction,
then do the calculation on the fly. I use Curve Expert to fit data to
curves. For my thermistor based cow thermometer, the curve was not pretty.
So, I took data points from the thermistor manufacturer (every 1 degree C)
and had the PIC do linear interpolation between these values. The circuit
uses a 16 bit ADC. The thermistor goes to ground with a pull-up (0.1%
resistor) to the ADC reference (so reference errors cancel). I used a
spreadsheet starting with the resistance for each degree C. The next
column had the calculated voltage for the voltage divider for each degree
C. The next column had the expected ADC value for each degree C. Another
column had calculated degrees F for each degree C. The PIC got three
tables (actually, arrays, since I wrote this in C). The raw ADC value does
a table lookup in the ADC array and calculates what fraction of the step
to the next value is needed to get the exact value. The same entry in the
F or C table is used, then linearly interpolated up to the correct value.
Works nicely!

Harold

--
FCC Rules Updated Daily at http://www.hallikainen.com

2006\01\25@110525 by Bob Axtell

face picon face
Don't overlook the fact that you can use a dual-pot chip, which will
give you much greater
range. One pot could "ROUGH IN" the value, and the other fine-tune it.

But you will still need the table, I guess.

--Bob

{Quote hidden}

--
Note: To protect our network,
attachments must be sent to
spam_OUTattachTakeThisOuTspamengineer.cotse.net .
1-520-850-1673 USA/Canada
http://beam.to/azengineer

2006\01\25@121411 by David VanHorn

picon face
On 1/25/06, Bob Axtell <.....engineerKILLspamspam@spam@cotse.net> wrote:
>
> Don't overlook the fact that you can use a dual-pot chip, which will
> give you much greater
> range. One pot could "ROUGH IN" the value, and the other fine-tune it.


Old analog techniques of adding resistors above and below the pot to narrow
the adjustment range, or adding resistors after the pot, from the wiper to
top and bottom, to shape the curve come to mind.

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