What's the maximum number of elements in a table?


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Pinckney, Michigan
    Posts
    91

    Default What's the maximum number of elements in a table?

    I need to store approx 300 words elements (600 bytes) in a table.

    It looks like Lookup2 craps out at 256 words, and Lookup does the same at 256 bytes.

    Any workarounds? (That EXT modifier looks kinda scary)

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: What's the maximum number of elements in a table?

    Quote Originally Posted by J. Mark Wolf View Post
    I need to store approx 300 words elements (600 bytes) in a table.

    It looks like Lookup2 craps out at 256 words, and Lookup does the same at 256 bytes.

    Any workarounds? (That EXT modifier looks kinda scary)

    One work around is to use two lookup2 statements. Placed one right after the other.

    Example, 150 in each words table,
    Code:
    Gosub MYTABLE
    
    
    MYTABLE:
    
    	If INDEX > 150 then MYTABLE2
    
    	LOOKUP2 INDEX, [1,....150],VAR
    
    	goto endtable
    
    MYTABLE2:
                    INDEX = INDEX - 150
    
    	LOOKUP2 INDEX,[151...300],VAR
    
    endtable:
    
    	Return
    Last edited by mark_s; - 27th March 2011 at 21:28.

  3. #3
    Join Date
    Oct 2005
    Location
    Pinckney, Michigan
    Posts
    91


    Did you find this post helpful? Yes | No

    Default Re: What's the maximum number of elements in a table?

    Quote Originally Posted by mark_s View Post
    One work around is to use two lookup2 statements. Placed one right after the other.

    Example, 150 in each words table,
    Thanks Mark_S

    I was able to re-scale the table down into 253 words and LOOKUP2 is fine with it.

    So, is 256 words a hard limit for PB Pro?

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: What's the maximum number of elements in a table?

    The holy manual says "Up to 255 (1024 for pic18fxxx) constants are allowed in the list" thats for Lookup.

    Lookup2 it states "Up to 85(1024 for pic18fxxx) values are allowed in the list"

    So, I guess it depends on what pic you are using 18f or 16f?

  5. #5
    Join Date
    Oct 2005
    Location
    Pinckney, Michigan
    Posts
    91


    Did you find this post helpful? Yes | No

    Default Re: What's the maximum number of elements in a table?

    Quote Originally Posted by mark_s View Post
    The holy manual says "Up to 255 (1024 for pic18fxxx) constants are allowed in the list" thats for Lookup.

    Lookup2 it states "Up to 85(1024 for pic18fxxx) values are allowed in the list"

    So, I guess it depends on what pic you are using 18f or 16f?
    I saw that also, after creating my LOOKUP2 table, but I'm using the new 16F1827, and the compiler didn't start balking until I got over 255 or 256 words (can't remember which).

    I whittled the table down to 253 words, and it's compiling fine. I figured there'd been an "undocumented capacity update" since the manual was last printed.

    I haven't yet down loaded any code to the device so we will see what happens then.

  6. #6
    Join Date
    Oct 2005
    Location
    Pinckney, Michigan
    Posts
    91


    Did you find this post helpful? Yes | No

    Default Re: What's the maximum number of elements in a table?

    Quote Originally Posted by mark_s View Post
    The holy manual says "Up to 255 (1024 for pic18fxxx) constants are allowed in the list" thats for Lookup.

    Lookup2 it states "Up to 85(1024 for pic18fxxx) values are allowed in the list"
    I posed the question to tech support.

    According to Darrel, the limit for LOOKUP2 and 16F parts has been bumped to 256 elements.

    That's good news for my application!

Members who have read this thread : 0

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