More help on LOOKUP tables please.


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Jul 2009
    Location
    Worcester South Africa
    Posts
    18

    Default More help on LOOKUP tables please.

    Can I put a few LABELS in a lookup table? If yes how can I then use the label returned to make the program GOTO that label? GOTO does not work with a variable.
    Thanks

    Surfies

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


    Did you find this post helpful? Yes | No

    Default Re: More help on LOOKUP tables please.

    Use ON GOTO or ON GOSUB.
    DT

  3. #3
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Re: More help on LOOKUP tables please.

    Do what Darrel says.

    However, if you need to intermix things in a LOOKUP table, then here is a method to achieve that:

    Code:
    lbl_1stPlace CON $FF
    lbl_2ndPlace CON $FE
    lbl_3rdPlace CON $FD
    lbl_4thPlace CON $FC
    My_Index_Var VAR WORD
    MY_LOOKUP_Var VAR WORD
    
    '-----------------------------------------------------------------
    
    LOOKUP My_Index_Var, [1,2, lbl_1stPlace,3,4, lbl_2ndPlace ,5,6, lbl_3rdPlace,7,8, lbl_4thPlace,9,10], MY_LOOKUP_Var
    SELECT CASE MY_LOOKUP_Var
     CASE lbl_1stPlace GOTO 1stPlace
     CASE lbl_2ndPlace GOTO 2ndPlace
     CASE lbl_3rdPlace GOTO 3rdPlace
     CASE lbl_4thPlace GOTO 4thPlace
    END SELECT
    
    '-----------------------------------------------------------------
    1stPlace:
    
    '-----------------------------------------------------------------
    2ndPlace:
    
    '-----------------------------------------------------------------
    3rdPlace:
    
    '-----------------------------------------------------------------
    4thPlace:

  4. #4
    Join Date
    Jul 2009
    Location
    Worcester South Africa
    Posts
    18


    Did you find this post helpful? Yes | No

    Default Re: More help on LOOKUP tables please.

    Thanks Darrel and SteveB will try that and let you know.

  5. #5
    Join Date
    Jul 2009
    Location
    Worcester South Africa
    Posts
    18


    Did you find this post helpful? Yes | No

    Default Re: More help on LOOKUP tables please.

    This ON GOTO command, does it work with PBP 2.32 ?? here is part of the code;

    COUNT PORTC.3, 15000, c1 'put pulses in C1

    ON c1 GOTO S1,S2,S3,S4,S5,S6,S7,S8 I get a syntax error on this line, do I miss something? S1 to S8 is labels, C1 is defined as a variable.
    Thanks.

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default Re: More help on LOOKUP tables please.

    does it work with PBP 2.32 ???


    Wowwww !!!

    PBP2.32 might be @ least 10 years old ... more than time to upgrade !

    my 2.50 version manual does not show ON GOxxx commands ( appears in the v2.60 manual ), sooo ... prepare your

    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 " !!!
    *****************************************

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