I couldn't get it to work using strings but it worked OK using numbers. Code posted below in case someone else asks the same question:
Select Case CMD_TABLE
Case 1: ReadTable ON_1, i, code
Case 2: ReadTable ON_2, i, code
Case 3: ReadTable ON_3, i, code
Case 4: ReadTable ON_4, i, code
Case 5: ReadTable OFF_1, i, code
Case 6: ReadTable OFF_2, i, code
Case 7: ReadTable OFF_3, i, code
Case 8: ReadTable OFF_4, i, code
End Select
Edit: And the lights are working great again!
Last edit: Peter 2015-12-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
It's nearly Christmas so I'm trying to get my light controller up and running again :)
I have lookup tables for some codes that I need to transmit (Table ON_1, Table ON_2, Table ON_3 etc)
Can I use a variable in ReadTable to use the table I require i.e. instead of
ReadTable ON2, i, code
I would have
Table2use = "On2"
ReadTable Table2use, i, code
I tried the above, but it wouldn't work and I get "Error: Lookup table Table2use not found" when I compile.
Last edit: Peter 2015-11-29
@Peter. Yes you can. Have a look at the demo files. The BMP demos redirect to different tables - you can get what you need via defines.
See http://sourceforge.net/projects/gcbasic/files/Demonstration%20Files/GLCD%20%20Solutions/GLCD%20Showing%20BMPs%20Solutions/GLCD_Load_Mutliple_BMPs_16f877a_for_KS0108.gcb for an example/
Thanks for the reply.
I couldn't get it to work using strings but it worked OK using numbers. Code posted below in case someone else asks the same question:
Edit: And the lights are working great again!
Last edit: Peter 2015-12-05