27404 Parallax Inc, 27404 Datasheet - Page 51

COMPETITION RING FOR SUMOBOT

27404

Manufacturer Part Number
27404
Description
COMPETITION RING FOR SUMOBOT
Manufacturer
Parallax Inc
Datasheet

Specifications of 27404

Accessory Type
Hobby and Education
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
SumoBot®
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
Changing EEPROM Values Between Resets
Let's take a closer look at how an EEPROM byte can be used to track the number of
times the SumoBot's Reset button has been pressed and released. This technique can also
be applied to counting the number of times the power to the BASIC Stamp has been
turned off and back on. You can just as easily insert the
from the next example program into an
This
EEPROM byte when the program is downloaded. The
becomes a constant for the address of that byte.
A byte variable will be used to manipulate a copy of the EEPROM value.
The program can then use the
byte whose address is
EepromCounter DATA
Modify the RunStatus
RunStatus DATA @10, Word 500
Modify the command that reads the EEPROM byte at the
like this:
READ RunStatus, Word temp
Test the program to make sure it can retrieve and display 500.
Check the Memory Map and verify that the
aside 2 bytes instead of 1.
EepromCounter DATA 0
temp VAR Byte
EEPROM is not a replacement for RAM. EEPROM bytes can certainly be used to store
values, count events, and so on. However, the EEPROM on the BASIC Stamp 2 is limited
to 10-million rewrites. In contrast, variables, which reference values stored in the BASIC
Stamp's RAM memory, do not have a limitation on the number of times you can rewrite the
values they store.
If your BASIC Stamp modifies a single byte in EEPROM once a minute, that EEPROM byte
will wear out in between 19 and 20 years. At once per second, the EEPROM byte will wear
out in around 4 months.
EepromCounter
directive from the next example program stores a 0 to an
READ
DATA
command to fetch the value stored in the EEPROM
directive like this:
, and copy it to the
IF...THEN
statement and count sensor events.
RunStatus DATA
Symbol
temp
READ
variable.
name
and
RunStatus
WRITE
EepromCounter
directive sets
commands
address

Related parts for 27404