You can create an array and store each character in that array. Remember, the BASIC Stamp has only 26 bytes of RAM / Variable space so dealing with strings can quickly consume that. It's often better to deal with strings on a byte-by-byte basis unless you have a BS2p or higher with SPRAM to store the string data. If the strings are constants they can be stored in EEPROM.
This takes advantage that the 'label' for a DATA statement is really an 'address' into the eeprom.·
And that the 'STR' modifier will accept a string address, expecting that string to end with a
'zero' byte.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
·
' {$STAMP BS2}
' {$PBASIC 2.5}
Str1 DATA "Hello",0
MyStr VAR Word
Main:
· MyStr = Str1
· SEROUT 16, 16864, [noparse][[/noparse]STR MyStr, CR]
· PAUSE 500
· GOTO Main
This takes advantage that the 'label' for a DATA statement is really an 'address' into the eeprom.·
And that the 'STR' modifier will accept a string address, expecting that string to end with a
'zero' byte.
·