Shop OBEX P1 Docs P2 Docs Learn Events
EEPROM space, can be used as a variable? — Parallax Forums

EEPROM space, can be used as a variable?

ArchiverArchiver Posts: 46,084
edited 2004-07-02 13:43 in General Discussion
Hello.

If I reserve EEPROM space at compile time, is there a way to use it
as a variable, for instance can I SERIN a string of text to an array
in EEPROM space? Is this possible?

What about scratchpad ram? Or is that ONLY usable via PUT and GET?

Thanks,

Ryan

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-06-30 14:14
    No, you cannot SERIN directly to EEPROM. You need to use a RAM variable
    with SERIN, then WRITE to put it into EEPROM. You can buffer a SERIN
    stream to Scratchpad (because its RAM and fast; EEPROM is slow). Like
    this:

    SERIN pin, baud, [noparse][[/noparse]SPSTR \12]

    This will capture 12 bytes from the serial stream and stuff them into
    the Scratchpad. Note that this feature is only available on the BS2p
    and BS2pe. You can then use GET to retrieve bytes from the Scratchpad.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: LostboY [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=sdJvqrGslyA5PzYjPREaEuX-AvJkcCKR1K5LVWIn7MRr_rvLO7bGdUGPVQWpk4ff7Ke-SXB_8ztJdtYKRA]hangook21@y...[/url
    Sent: Wednesday, June 30, 2004 12:52 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] EEPROM space, can be used as a variable?


    Hello.

    If I reserve EEPROM space at compile time, is there a way to use it
    as a variable, for instance can I SERIN a string of text to an array
    in EEPROM space? Is this possible?

    What about scratchpad ram? Or is that ONLY usable via PUT and GET?

    Thanks,

    Ryan
  • ArchiverArchiver Posts: 46,084
    edited 2004-07-02 13:43
    SPSTR was unintentionally omitted from the manual. As I frequently
    recommend, use the Help file as it is easier to distribute so it
    contains the latest information.

    Yes, SPSTR always starts writing at location 0, and its only limitation
    is number of bytes; it does not look for a terminating character.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: LostboY [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=k3pCi0hCfHk2E4r9Qqw7Y1FSA51yvpmuAP3FhFY3CtqmhJuQion--Hzrui5DQdao6bnyJzvgQtsZMg]hangook21@y...[/url
    Sent: Friday, July 02, 2004 12:51 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Re: EEPROM space, can be used as a variable?


    --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
    wrote:
    > No, you cannot SERIN directly to EEPROM. You need to use a RAM
    variable
    > with SERIN, then WRITE to put it into EEPROM. You can buffer a
    SERIN
    > stream to Scratchpad (because its RAM and fast; EEPROM is slow).
    Like
    > this:
    >
    > SERIN pin, baud, [noparse][[/noparse]SPSTR \12]
    >
    > This will capture 12 bytes from the serial stream and stuff them
    into
    > the Scratchpad. > -- Jon Williams

    Thanks for the answer. Can I set a certain character to terminate,
    like this:

    SERIN pin, baud, [noparse][[/noparse]SPSTR \12 \$AA]

    ?

    Also, I assume that SPSTR is "scratch pad string" yet I cannot find
    this instruction anywhere in the Basic Stamp Manual. Is there
    anywhere this instruction is documented, or is this just a variable
    name that you have assigned, if so, how do I allocate a 'scratch pad'
    variable? I was under the impression that the only way to access the
    scratch pad ram was with the "get" and "put" set of instructions.

    Also, with the above command, will it aways begin putting the ASCII
    at location scratch pad 0? (ie can I tread scratch pad ram as a big
    array?)

    Thanks again,

    Ryan
Sign In or Register to comment.