BASIC stamp manual v2.2

READ – BASIC Stamp Command Reference
Page 372 BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com
Memory Map of the program before you download it. On all BS2 models
you will need to view the Memory Map of the program before you
download it, to determine the last EEPROM location used. See the
"Memory Map Function" section in Chapter 3.
On the BS2p, BS2pe, and BS2px, the READ and WRITE commands can
affect locations in any program slot as set by the STORE command. See
the STORE command for more information.
Demo Program (READ.bs1)
' READ.bs1
' This program reads a string of data stored in EEPROM. The EEPROM data is
' downloaded to the BS1 at compile-time and remains there (even with the
' power off) until overwritten. Put ASCII characters into EEPROM, followed
' by 0, which will serve as the end-of-message marker. For programs with
' multiple strings, use the Memory Map window to find the starting
character
' address.
' {$STAMP BS1}
' {$PBASIC 1.0}
SYMBOL strAddr = B2
SYMBOL char = B3
Msg1:
EEPROM ("BS1", 13, "EEPROM Storage!", 0)
Main:
strAddr = 0 ' set to start of message
GOSUB String_Out
END
String_Out:
READ strAddr, char ' read byte from EEPROM
strAddr = strAddr + 1 ' point to next character
IF char = 0 THEN StrOut_Exit ' if 0, exit routine
DEBUG #@char ' otherwise print char
GOTO String_Out ' get next character
StrOut_Exit:
RETURN
1