Is there a way to assign a $tring to a variable? (P$ = "test")
IceFirePro
Posts: 86
Can I assign string value to a variable in BS2?
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.
·