Shop OBEX P1 Docs P2 Docs Learn Events
text strings — Parallax Forums

text strings

jthibjthib Posts: 2
edited 2005-04-18 19:35 in BASIC Stamp
Can anyone tell me how to store a text string in a variable....if not a variable maybe some other means?· I am trying to store up to 35 characters in a variable and then use that variable in a subroutine.· If·someone could help me it would be greatly appreciated.

·

Comments

  • NewzedNewzed Posts: 2,503
    edited 2005-04-18 14:19
    You can't do that.· Stamps have an absolute max of 26 bytes.· I have stored 16, but you always need other variables, so that is about the limit.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    NEW! 4 MB EEPROM

    http://hometown.aol.com/newzed/page4.html
    ·
  • BeanBean Posts: 8,129
    edited 2005-04-18 14:54
    You'll have to store it in EEPROM or scratchpad memory.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video Display Module" Available Now.

    www.sxvm.com

    "A problem well defined, is a problem·half solved."
    ·
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-04-18 15:39
    Are you looking to store constant strings or variable strings? For constant strings, store them in EEPROM, for variable strings you'll have to create them on the fly.
  • dandreaedandreae Posts: 1,375
    edited 2005-04-18 15:49
    This can be done using the BS2p, BS2pe, and the BS2px.· There is a special formatter called "SPSTR L".· You can find more information on page 392 of the BASIC Stamp Manual version 2.1.· Here is a link for the download of the manual:·

    http://www.parallax.com/html_pages/downloads/basicstamps/documentation_basic_stamp.asp


    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    www.parallax.com

    ·
  • jthibjthib Posts: 2
    edited 2005-04-18 19:33
    What I would like to do is load a variable with a phrase(up to 35 characters). The reason I would like to have a variable is so that I do not have to write this same line of code multiple times. This is the code: I2COUT SDA, $c4, 0, [noparse][[/noparse]NOP, 0,5,3, "Good bye ", 0]. I would like to replace the Good bye with a variable. I want to have subroutines load this variable with different phrases that are defined in my code. I want to save memory and it seems if I don't have repeat this same line of code multiple times it would save a bunch of memory. Thanks for the help. I have a bs2p40.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-18 19:35
    You could read the byte -- one at a time -- into the Stamp and then store them in lower EEPROM with WRITE. Use a zero-terminator so you know where the string ends; then it can be sent back out (again, one character at a time) whenever you need it. Look a StampWorks -- there's a terminal project that shows how to change a string stored in EE.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
Sign In or Register to comment.