BASIC Stamp FAQ

STAMP FAQS PROGRAMMING INFORMATION
Last Revised On: 7/21/00 Page: 19
The LET command is not available on the BASIC Stamp II, IIe and IIsx. Does this mean
the BASIC Stamp II, IIe and IIsx cannot perform mathematical operations?
No. The LET command on the BASIC Stamp I was optional; i.e.: you could leave it out of the variable assignment
statement or equation and it would work normally. To save some space in the interpreter code of the BASIC
Stamp II, IIe and IIsx, the LET command was removed completely, however, the mathematical ability was not
removed and, in fact, it is greatly improved on the BASIC Stamp II, IIe and IIsx.
Can the BASIC Stamp store data, such as temperature readings, for review or use at a
later time?
Yes. The READ and WRITE commands allow the BASIC Stamp to manipulate memory locations in its
EEPROM. Any space in the built-in EEPROM that is not occupied by PBASIC code may be used for data
storage and is just as non-volatile as the PBASIC code itself. You may also attach external EEPROMs of various
sizes to gain an even greater data storage area. The READ and WRITE commands will not function on external
EEPROMs so you must write the appropriate code to interface with the device.
How can I store a word value into the internal EEPROM?
The internal EEPROM of the BASIC Stamp (used for both program and data storage) is organized and accessed in
units of bytes only. Since a word value is actually two bytes it requires two consecutive memory locations to store it
in EEPROM. You must break the word value into its lower and upper byte parts and use two WRITE commands
to store the value, or two READ commands to retrieve it.
The following code demonstrates this for the BASIC Stamp I:
W0 = 1250
WRITE 0, B0
WRITE 1, B1
The following code demonstrates this for the BASIC Stamp II:
Temp VAR WORD
Temp = 1250
WRITE 0, Temp.LOWBYTE
WRITE 1, Temp.HIGHBYTE