28125 Parallax Inc, 28125 Datasheet - Page 167

TEXT ROBOTICS

28125

Manufacturer Part Number
28125
Description
TEXT ROBOTICS
Manufacturer
Parallax Inc
Datasheet

Specifications of 28125

Title
Robotics with the Boe-Bot
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
Example Program – EepromNavigationWithWordValues.bs2
This next example program looks complicated at first, but it is a very efficient way to
design programs for custom Boe-Bot choreography. This example program uses
EEPROM data storage, but does not use subroutines. Instead, a single code block is
used, with variables in place of the
arguments.
By default, the
sized data items, you can add the
item in your string. Each word-sized data item will use two bytes of EEPROM storage,
so the data will be accessed via every other address location. When using more than one
DATA
commands can refer to the label to retrieve data items without you having to figure out at
which EEPROM address each string of data items begins.
snippet:
Each of the three
before each data item, and the items are separated by commas. These three strings of
data will be stored in EEPROM one after another. We don’t have to do the math to
figure out the address number of a given data item, because the labels and the
addressOffset
to determine the EEPROM address where that string begins, and then adds the value of
the
correct
READ
the variable that stores the value fetched from EEPROM.
addressOffset
directive, it is most convenient to assign a label to each one. This way, your
command's
DataItem
' addressOffset
Pulses_Count DATA Word 64,
Pulses_Left
Pulses_Right DATA Word 650, Word 650, Word 850, Word 850
DO
READ Pulses_Count + addressOffset, Word pulseCount
READ Pulses_Left + addressOffset, Word pulseLeft
READ Pulses_Right + addressOffset, Word pulseRight
addressOffset = addressOffset + 2
' PBASIC code block omitted here.
DATA
variable will do that automatically. The
Variable
. The
DATA
variable to know how many address numbers to shift over to find the
directive stores bytes of information in EEPROM. To store word-
DataItem
DATA Word 850, Word 650, Word 850, Word 650
statements begins with its own label. The
argument. Notice that the
0
Word
found at the resulting
FOR
...
modifier to the
NEXT
2
Word 24,
loop's
EndValue
Word
DATA
4
Word 24,
READ
Address
modifier also comes before
directive, before each data
command uses each label
Take a look at this code
and
will be stored in the
Word
PULSOUT Duration
6
Word 64, Word 0
modifier goes
8
READ

Related parts for 28125