BASIC stamp manual v2.2

WRITE – BASIC Stamp Command Reference
Page 462 BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com
On the BS1, location 255 holds the address of the last instruction in your
program. Therefore, your program can use any space below the address
given in location 255. For example, if location 255 holds the value 100,
then your program can use locations 0–99 for data. You can read location
255 at run-time or simply view the 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 section of 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 (WRITE.bs1)
' WRITE.bs1
' This program writes a few bytes to EEPROM and then reads them back out
' and displays them in the Debug window.
' {$STAMP BS1}
' {$PBASIC 1.0}
SYMBOL addr = B2 ' address
SYMBOL value = B3 ' value
Main:
WRITE 0, 100 ' write some data to locations 0 - 3
WRITE 1, 200
WRITE 2, 45
WRITE 3, 28
Read_EE:
FOR addr = 0 TO 3
READ addr, value ' read value from address
DEBUG #addr, ": ", #value, CR ' display address and value
NEXT
END
1