Datasheet

Page 46· Applied Robotics with the SumoBot
the right by 16
1
= 16, then the third digit from the right by 16
2
= 256, and so on. Add up
all the products, and you've got your conversion. For example,
7C3 = (3 × 16
0
) + (C × 16
1
) + (7 × 16
2
) place values
= (3 × 1) + (C × 16) + (7 × 256) power expansion
= (3 × 1) + (12 × 16) + (7 × 256) hex digit value
= 3 + 192 + 1792
= 1987
The first five bytes in the EEPROM map are the hexadecimal equivalents of list of
DataItems from the Numbers DATA directive: 7, 20, 11, 2, and 80. The fifth byte is 0
from the
RunStatus DATA directive. Notice on your monitor that the next 20 bytes have
a darker green color code corresponding to undefined data. These are the EEPROM
bytes that were reserved by the
UndefData DATA directive. The final list of digits starts
at hexadecimal address 1A (decimal-26). These are the ASCII codes for "A", "B", "C",
etc.
To view the list of characters in the last
DATA directive, click the Display ASCII
checkbox in the Memory map window.
Look for the ABCDEFG in the Memory Map.
DATA directives build sequentially from EEPROM address 0 upward. However, you can
use the optional
@Address operator to specify a particular starting address for each DATA
directive.
Use the optional @
Address operator to move RunStatus to the 10th byte in
EEPROM like this:
RunStatus DATA @10, 0
View the Memory Map again and note the effect.
Try the example program with this modification. Because of the way the
optional
Symbol names are used, it should make no difference to the way the
program behaves.
You can also use the
Word modifier to store values larger than 255. The Word modifier
stores the value in EEPROM as 2 bytes. It works with the
DATA directive as well as the
READ and WRITE commands.