BASIC stamp manual v2.2
5: BASIC Stamp Command Reference – READ
BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com • Page 373
Demo Program (READ.bs2)
' READ.bs2
' This program reads a string of data stored in EEPROM. The EEPROM data is
' downloaded to the BS2 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.
' {$STAMP BS2}
' {$PBASIC 2.5}
strAddr VAR Word
char VAR Byte
Msg1 DATA "BS2", CR, "EEPROM Storage!", 0
Main:
strAddr = Msg1 ' set to start of message
GOSUB String_Out
END
String_Out:
DO
READ strAddr, char ' read byte from EEPROM
strAddr = strAddr + 1 ' point to next character
IF (char = 0) THEN EXIT ' if 0, exit routine
DEBUG char ' otherwise print char
LOOP
RETURN
All
2
NOTE: This example program can be
used with all BS2 models by changing
the $STAMP directive accordingly.