5: BASIC Stamp Command Reference – READ
BASIC Stamp Programming Manual 2.0c • www.parallaxinc.com • Page 263
location 255 holds the value 100, then your program can use locations 0–99
for data.
On other BASIC Stamps, you'll 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, 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.bas)
' 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.
'{$STAMP BS1} 'STAMP directive (specifies a BS1)
EEPROM ("BS1 EEPROM Storage!",0)
SYMBOL StrAddr = W0
SYMBOL Char = B2
StrAddr = 0 'Set address to start of Message.
StringOut:
READ StrAddr,Char 'Get a byte from EEPROM.
IF Char <> 0 THEN Cont 'Not end? Continue.
END 'Stop here when done.
Cont:
DEBUG @Char 'Show character on screen.
StrAddr = StrAddr + 1 'Point to next character.
GOTO StringOut 'Get next character.
Demo Program (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} 'STAMP directive (specifies a BS2)
Message DATA "BS2 EEPROM Storage!",0
StrAddr VAR WORD
Char VAR BYTE
2
2
2
2
2
2
NOTE: This is written for the BS2
but can be used for the BS2e,
BS2sx and BS2p also. Locate the
proper source code file or modify
the STAMP directive before
downloading to the BS2e, BS2sx or
BS2p.
2