Need help with lookup table or direct calculation


Closed Thread
Results 1 to 25 of 25

Hybrid View

  1. #1
    Join Date
    Jul 2005
    Posts
    78


    Did you find this post helpful? Yes | No

    Default

    That's a rather involved calculation to be sure. Honestly, I gave up trying to follow it.

    You have just 1024 input values, I assume these lead to 1024 discrete output values else you wouldn't be looking for a look-up table solution.

    However, can you solve this by some other simpler method? Piecewize linear, interpolation polynomial, or such? Do you have say an excel spreadsheet with the results calculated?

    Also, you don't need EEPROM to save values, you can use RETLW (Return with literal in W) to get a byte look up table, that will take 2048 memory locations to get 1024 words (and yeah, its assembler, but not much).

  2. #2
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Default

    What type of thermometer do you use ?

    I always make a table of maybe 30 points and make an interpolation between this points. It is good for me, but I don't know, what you need...
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  3. #3
    Join Date
    Oct 2006
    Posts
    25


    Did you find this post helpful? Yes | No

    Default

    Ernie,

    Yes I do have an excel spreadsheet with the values calculated. And I could possibly linearize the curve but loose accuracy. But about this RETLW command, how does it work and where can I find the syntax etc etc for it?

  4. #4
    Join Date
    Oct 2006
    Posts
    25


    Did you find this post helpful? Yes | No

    Default

    Darrel,

    I don't think I can use that approach since the ADCIN command only lets you store the result in a VAR not a CON. How would I tell it what values from 0-1023 to pull out from memory?

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    The reading from the POT should be put in a variable.

    The CON is the address of the Data Table that gets stored in program memory.

    Then the A/D reading would be used as an offset into the data table in order to find the correct value.
    <br>
    DT

  6. #6
    Join Date
    Oct 2006
    Posts
    25


    Did you find this post helpful? Yes | No

    Default

    Thanks Darrel,

    I works GREAT! I just hope now there isn't a limit to the number of values I can put in the Datatable. If there is, then i'm praying that its 1024!!!!!

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Nope,

    You are only limited by the amount of available memory in Program Space.

    Cheers,
    DT

  8. #8
    Join Date
    Oct 2006
    Posts
    25


    Did you find this post helpful? Yes | No

    Default

    Well I got a 125KB, I think I should be fine!

    Thanks,
    Nikhil

Similar Threads

  1. Lookup table syntax.....
    By TerdRatchett in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th May 2009, 04:45
  2. Lookup table or Math?
    By ronjodu in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 2nd May 2008, 17:55
  3. Lookup Table
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 11th March 2008, 10:38
  4. problem with USART
    By leemin in forum Serial
    Replies: 4
    Last Post: - 11th December 2006, 17:56
  5. Real Time Clock & Eeprom
    By smart_storm in forum General
    Replies: 8
    Last Post: - 17th February 2006, 19:03

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts