27404 Parallax Inc, 27404 Datasheet - Page 45

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
Chapter 2: EEPROM Tricks and Program Tips · Page 41
Chapter #2: EEPROM Tricks and Program Tips
The BASIC Stamp's EEPROM is a great tool for storing values that you don't want to get
erased. After you've stored a value to EEPROM, it doesn't matter whether the power has
been turned off or the Reset button has been pressed and released. The value will still be
there (in EEPROM) when your program needs it.
This chapter introduces some of the techniques that will be reused in later chapters for
things like self-calibrating sensors (Chapter 3) and datalogging a sumo round (Chapter 5).
This chapter also takes a closer look at how a PBASIC program can make the Reset
button function as an on/off switch for sumo wrestling mode. When used with a
pushbutton, speaker, and LED, the EEPROM programming techniques make it possible
to select between many different modes of operation, which can come in handy for
strategy changes on the fly.
This chapter also introduces some conventions that will allow you to use just a couple of
variables to do many different jobs. These conventions, along with some program design
and organization strategies, will make it possible for you to mix and match old code into
future application programs.
EEPROM AND PROGRAM MANAGEMENT
directives are great tools for setting aside bytes, words, and clusters of bytes for
DATA
later use in the program.
directives can pre-store values in EEPROM, and they can
DATA
also give the beginning of a group of reserved EEPROM bytes a unique name that your
program can then use to always find the particular bytes it needs to do its jobs.
Regardless of whether you're logging data, calibrating sensors, or toggling between
wrestling modes, if you've arranged your EEPROM with
directives that have
DATA
names, it will make retrieving and storing all the values a snap.
Symbol
Following common code conventions also yields a variety of benefits. For example, if
your subroutines make effective use of temporary variables for counting and
manipulating values, you'll be able to copy subroutines from old programs into new
programs and get them working with minimal trouble-shooting. Another feature that
helps when combining old and new programs is maintaining clearly defined sections, like
EEPROM Data, Variables, Main Routine, Subroutines, and so on. When integrating
parts of older programs into current programs, going through section by section greatly
simplifies the job.

Related parts for 27404