BASIC stamp manual v2.2

EEPROM – BASIC Stamp Command Reference
Page 186 BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com
READ commands will read the low-byte and high-byte out of EEPROM
(reconstructing it in a word-sized variable) and then display the value on
the screen. See the READ and WRITE commands for more information.
Demo Program (EEPROM.bs1)
' EEPROM.bs1
' This program stores a couple of text strings into EEPROM with the EEPROM
' directive and then sends them, one character at a time via the SEROUT
' command. This is a good demonstration of how to save program space by
' storing large amounts of data in EEPROM directly, rather than embedding
' the data into SEROUT commands.
' {$STAMP BS1}
' {$PBASIC 1.0}
SYMBOL SOut = 0 ' serial output
SYMBOL idx = B2 ' Holds current location number
SYMBOL phrase = B3
SYMBOL char = B4 ' Holds current character to print
Phrases:
EEPROM ("Here is a long message that needs to be transmitted.", 13, 0)
EEPROM ("Here is some more text to be transmitted.", 13, 0)
Main:
idx = 0
FOR phrase = 1 TO 2 ' select phrase
GOSUB Print_It ' print the phrase
PAUSE 3000 ' Pause for 3 seconds
NEXT
END
Print_It:
READ idx, char ' get next character
idx = idx + 1 ' point to next EEPROM location
IF char = 0 THEN Print_Done ' if 0, we're done with this block
SEROUT SOut, N2400, (char) ' otherwise, transmit it
'DEBUG #@char ' -- for demo with DEBUG (slower)
GOTO Print_It
Print_Done:
RETURN ' return to caller
1