Constants with BS2 and PBASIC 2.5
JimG
Posts: 84
I want to be sure of what I am reading.· If I understand correctly you cannot define a CONSTANT that is a string, only a numeric value?· Is that any other method of pre-deining and naming a set of values short of setting up a variable for each one?
EX:
DoThisOrThat·· CON· "?f7"
Thanks,
Jim
EX:
DoThisOrThat·· CON· "?f7"
Thanks,
Jim
Comments
You again, huh? I am building a template to use to paint LCD's. It would be really nice if I could define all the various command strings with an English language Name. I can just put it all in as rem'ed text and pull out what I want...not as elegant but will work.
Ex:
MoveCursorRight CON "?i"
Jim
What a great idea!! Doesn';t this consume lot of memory to store all the subs?
J
Thus:
MyStr1 DATA "Hello", 0
MyStr2 DATA "Hello again", 0
SEROUT 16, 16864, [noparse][[/noparse]STR MyStr1, 13] ' Outputs "Hello" and CR, at 9600 baud, out programming port.
SEROUT 16, 16384, [noparse][[/noparse]STR MyStr2, 13] ' Outputs "Hello again" and CR
Your program is stored in EEPROM from 'top down', while DATA statements are stored in EEPROM from 'Bottom up' -- that is, address zero up.
This might be a route to take too. Of course you have to be able to do simple math to use data staements and I am still on intermediate add and subtract.
Thanks,
Jim
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
J
MoveCursorRight CON "?i"
Debug DEC MoveCursorRight ' print the address
pointer = MoveCursorRight ' now pointer contains the address
READ pointer, char ' what's there, the first byte?
DEBUG TAB,HEX2 char '
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Thanks,
Jim