Lookup table not accepting strings


Closed Thread
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Posts
    747

    Default Lookup table not accepting strings

    I know PBP do not handle strings too well. I would like to get an idea on how to get this issue solved.
    Obviously this Lookup command do not work, but if PBP could handle it, it is exactly what I need. What is the best way to make this work. I think the program is pretty much self explainable.
    K


    Code:
    Lookup Beverage_type, [Coke, Pepsi, DietCoke, DietPepsi],B1      
    
    '/////////////////////////////////////////  
    '///////  Selection beverage type  ///////////
    '/////////////////////////////////////////
    Selection_beverage_type:
    
    		lcdout $FE,1,  " Type: ", B1
    		lcdout $FE,$C0, "Next or Select"
    		pause 200
    		if Selection=1 then return
    		if Next1=1 then 
    			Beverage_type = Beverage_type+ 1
    			if Beverage_type > 3 then Beverage_type = 0
    			Gosub Selection_beverage_type
    		Endif
    Return

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default

    Hi,
    This compiles OK but is not tested, perhaps it could serve as a starting point:
    Code:
    Coke CON 0
    Pepsi CON 1
    DietCoke CON 2
    DietPepsi CON 3
     
    Row1 VAR BYTE[16]    'Array for 1st line of LCD
    Length VAR BYTE
     
    Select Case Beverage_Type
    Case Coke
     ArrayWrite Row1, ["Coke"]
     Length = 4
    Case Pepsi
     ArrayWrite Row1, ["Pepsi"]
     Length = 5
    Case DietCoke
     ArrayWrite Row1, ["Diet Coke"]
     Length = 9
    Case DietPepsi
     ArrayWrite Row1, ["Diet Pepsi"]
     Length = 9
    END SELECT
     
    LCDOUT $FE, 1, STR Row1 \Length
    /Henrik.

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