Shop OBEX P1 Docs P2 Docs Learn Events
Use of data in EEPROM — Parallax Forums

Use of data in EEPROM

ArchiverArchiver Posts: 46,084
edited 2000-06-07 01:43 in General Discussion
Larry-

Here are a couple of possibilities. If your strings are really
constant, just embed them in the SEROUT statements themselves, e.g.:

serout Tx,BaudTx,[noparse][[/noparse]"abcdefg"]

Or, you could read the eeprom data into an array variable and then
transmit the array as described in page 323 of the BS2 manual.


Steve


On 6 Jun 00 at 13:13, Larry Pfeffer wrote:

> Does someone know how to create a byte array filled by compiler with
> a string constant in EEPROM and refer to the string in one simple
> SEROUT statement?

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-06-06 06:17
    On 6 Jun 00 at 17:43, Larry Pfeffer wrote:

    > ...Do you know how to store the literal in EEPROM and _without a
    > loop_ (for reason in my inquiry and also for
    > simplicity/readability) be able to transmit the constant from
    > EEPROM via single SEROUT?

    Can't be done--the interpreter does not support this capability. Use
    of GOSUBs to optimize SEROUT-literal storage, loading your variable
    array prior to executing the SEROUT, and variable space
    redefinitions to temporarily use variable space for array purposes
    may present workarounds to allow use of a Stamp for this application.

    Steve
  • ArchiverArchiver Posts: 46,084
    edited 2000-06-06 21:13
    Does someone know how to create a byte array filled by compiler with a string
    constant in EEPROM and refer to the string in one simple SEROUT statement? I
    set up a constant string like

    MyString DATA "abcdefg",0

    and also as MyString DATA "abcdefg"

    and referred to it via

    serout Tx,BaudTx,[noparse][[/noparse]MyString]

    PBasic complier doesn't flag above as errors, but the string is not
    transmitted. Clearly it is possible to loop thru the literal in EEPROM and
    transmit one character a time until a 0 sentinel is found, but our application
    is timing sensitive and the loop slows it down on an already slow BS2 (and may
    also unneccessarily drop Baud rate).

    Thanks.
  • ArchiverArchiver Posts: 46,084
    edited 2000-06-07 01:43
    Steve,
    At 06:12 AM 6/6/00 +0800, you wrote:
    >Larry-
    >
    >Here are a couple of possibilities. If your strings are really
    >constant, just embed them in the SEROUT statements themselves, e.g.:
    >
    > serout Tx,BaudTx,[noparse][[/noparse]"abcdefg"]
    Of course. This, however, requires storing repeating literals multiple
    times ... (unless PBASIC optimizes the literal pool). Also for long,
    multiply occuring literals, program readability is reduced. Do you know how
    to store the literal in EEPROM and _without a loop_ (for reason in my
    inquiry and also for simplicity/readability) be able to transmit the
    constant from EEPROM via single SEROUT?
    >
    >Or, you could read the eeprom data into an array variable and then
    >transmit the array as described in page 323 of the BS2 manual.
    Loop won't work for our application due to severe overhead introduced by
    loop --- we have a time sensitive application and the loop a) reduces baud
    rate and b) makes it even more difficult to handle potentail concurrent
    events. Also, one of the main reasons for storing constant data in EEPROM
    is severe lack of RAM in BS2. In our application there is no room for a RAM
    resident byte array.


    Thanks,
    Larry

    >On 6 Jun 00 at 13:13, Larry Pfeffer wrote:
    >
    >> Does someone know how to create a byte array filled by compiler with
    >> a string constant in EEPROM and refer to the string in one simple
    >> SEROUT statement?
    >
    >
    >
Sign In or Register to comment.