Use of data in EEPROM
Archiver
Posts: 46,084
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?
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
> ...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
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.
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?
>
>
>