Lookup Table


Closed Thread
Results 1 to 7 of 7

Thread: Lookup Table

  1. #1

    Default Lookup Table

    Hi anyone. I want to make a lookup table in my program. At the first I wanted to make it with LOOKUP. But I want to use program memory instead of RAM. So I think
    that LOOKUP instruction can't help me in this regard! I make this lookup table in asm:

    ASM
    TABLE
    ADDWF 02,1
    RETLW 0X01
    RETLW 0X02
    RETLW 0X04
    RETLW 0X08
    RETLW 0X10
    RETLW 0X20
    RETLW 0X40

    .
    .
    .

    RETLW 0X80
    ENDASM
    END

    I recall table with CALL TABLE. Unfortunately it doesn't work. Why? What should I do? Thanks for helpful replies.

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Hi,

    PEEKCODE and POKECODE should do it nicely ... just read the manual ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Default

    also find this excellent thread started by Melanie

    "Making Program Code Space your playground"
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi yasser,

    What precisely are you trying to do? PBP does not use RAM to create lookup tables except for the index & result variables.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  5. #5


    Did you find this post helpful? Yes | No

    Unhappy Peek, Poke, DB, ASM ...?

    Hi and thanks for your replies. I visited above links. I want to save data on program memory space and send them to LEDs byte by bytes. This is a part of my program:


    Send:
    StrAddr = $370
    for j = 0 to 2
    CharAddr = StrAddr + (80*j)
    for k = 0 to 79
    PeekCode CharAddr+k, x
    GOSUB DISPLAY

    next k
    next j
    RETURN

    Send_Back:
    StrAddr = $460
    for j = 2 to 0 step -1
    CharAddr = StrAddr + (80*j)
    for k = 79 to 0 STEP -1
    PeekCode CharAddr+k, x
    GOSUB DISPLAY

    next k
    next j
    RETURN

    '************************************************* ****************
    ' Introduction of Image *
    '************************************************* ****************

    @ org 370h

    Pokecode $00,$00,$00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$0 1,$01,$01,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00, $00,$00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$01,$0 1,$01,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00,$00, $00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$01,$01,$0 1,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00,$00,$00, $00,$01,$01,$01,$03
    Pokecode $00,$00,$00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$0 1,$01,$01,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00, $00,$00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$01,$0 1,$01,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00,$00, $00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$01,$01,$0 1,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00,$00,$00, $00,$01,$01,$01,$03
    Pokecode $00,$00,$00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$0 1,$01,$01,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00, $00,$00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$01,$0 1,$01,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00,$00, $00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$01,$01,$0 1,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00,$00,$00, $00,$01,$01,$01,$03



    -------------------------------------------
    It doesn't work. Why?
    Can you tell me about DB usage? How can I use it? I used ASM code (as I said above). Why didn't it work correct?
    Thanks alot

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

  7. #7


    Did you find this post helpful? Yes | No

    Default Thanks

    Thanks all.
    Regards

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. problem with USART
    By leemin in forum Serial
    Replies: 4
    Last Post: - 11th December 2006, 17:56
  4. Need help with lookup table or direct calculation
    By nverma in forum mel PIC BASIC Pro
    Replies: 24
    Last Post: - 11th October 2006, 18:27
  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 : 1

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