Parallax BASIC Stamp 2e Programming Manual page 265

Table of Contents

Advertisement

2
2
e
2
2
e
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.
5: BASIC Stamp Command Reference – READ
location 255 holds the value 100, then your program can use locations 0–99
for data.
2
2
On other BASIC Stamps, you'll need to view the Memory Map of the
p
sx
program before you download it, to determine the last EEPROM location
used. See the "Memory Map Function" section in Chapter 3.
2
On the BS2p, the READ and WRITE commands can affect locations in any
p
program slot as set by the STORE command. See the STORE command for
more information.
Demo Program (READ.bas)
1
' 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}
EEPROM ("BS1 EEPROM Storage!",0)
SYMBOL
StrAddr
SYMBOL
Char
StrAddr = 0
StringOut:
READ StrAddr,Char
IF Char <> 0 THEN Cont
END
Cont:
DEBUG @Char
StrAddr = StrAddr + 1
GOTO StringOut
2
2
Demo Program (READ.bs2)
sx
p
' 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}
Message
DATA "BS2 EEPROM Storage!",0
StrAddr
VAR
Char
VAR
= W0
= B2
'Set address to start of Message.
WORD
BYTE
BASIC Stamp Programming Manual 2.0c • www.parallaxinc.com • Page 263
'STAMP directive (specifies a BS1)
'Get a byte from EEPROM.
'Not end? Continue.
'Stop here when done.
'Show character on screen.
'Point to next character.
'Get next character.
'STAMP directive (specifies a BS2)

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the BASIC Stamp 2e and is the answer not in the manual?

Table of Contents