Lookup with variable contents??


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2013
    Posts
    32

    Default Lookup with variable contents??

    Hello,
    I searched some threads releated wiht this but I couldn't see an efficient answer unfortunately, so I had to open a new thread.

    What I wonder is it possible to use a variable in lookup?
    I need to get variable's content as a string data to send it to display.
    What I'm trying to say is that I want to do sompething like this;

    for table_index=0 to X
    lookup table_index,["Variable Value is:",myVar],store_data
    gosub subroutine
    next table_index

    subroutine:
    'send store_data to output

    now, if MyVar contains 100, I want to send it to subroutine digit by digit as table_index increases, like; V a r i ..... 1 0 0. Not V a r i ......100

    is this possible with lookup? or a backdoor to do this?

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


    Did you find this post helpful? Yes | No

    Default Re: Lookup with variable contents??

    Just open your manual @ LOOKUP2 ...
    The Value list can be a mixture of 8-bit and 16-bit (and 32-bit for PBPL) numeric and string constants and variables
    also may be using a pointer ...
    ( noooo ... not on the head !!! )

    Alain
    Last edited by Acetronics2; - 16th June 2015 at 21:30.
    ************************************************** ***********************
    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
    May 2013
    Location
    australia
    Posts
    2,388


    Did you find this post helpful? Yes | No

    Default Re: Lookup with variable contents??

    if you have pbp3

    ARRAYWRITE store_data ["Variable Value is:",dec myVar]

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,520


    Did you find this post helpful? Yes | No

    Default Re: Lookup with variable contents??

    Hi,
    Although I highly recommend getting PBP3 anyway it's not strictly needed for ARRAYREAD/ARRAYWRITE as those commands were added in v2.6.

    /Henrik.

  5. #5
    Join Date
    Apr 2013
    Posts
    32


    Did you find this post helpful? Yes | No

    Default Re: Lookup with variable contents??

    Many thanks, altough I couldn't use arraywrite, lookup2 and DIG combination solved it
    Actually I checked lookup2 before but I think I misread it's explanation, I was thinking that lookup2 is for 16bit table. I was totally wrong XD

Similar Threads

  1. Overwriting previous address contents... oh no - not again!
    By PerlNoerd in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 11th February 2014, 16:24
  2. Replies: 4
    Last Post: - 8th May 2012, 06:00
  3. Replies: 8
    Last Post: - 3rd March 2011, 22:20
  4. Lookup
    By chip_select in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 6th April 2008, 02:34
  5. Saving variable(s) contents before power is removed
    By emavil in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 15th July 2007, 17:26

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