Datasheet

Page 236ยท Applied Robotics with the SumoBot
because we do not want to overwrite all the recorded records from the round the
SumoBot just finished before they get displayed.
DATALOG_MODE = 2 is for playing back the recorded values from EEPROM. This
playback will use all the features that
DEBUG_MODE = 1 used in the previous activity's
example program. This
#IF statement used to just have the DEBUG_MODE = 1 condition.
Now, it also has the
DATALOG_MODE = 2 condition. The OR operator makes it so that
either or both of the conditions can be true for the DEBUG command to get compiled.
#IF DEBUG_MODE = 1 OR DATALOG_MODE = 2 #THEN
DEBUG CLS,
"Sensors State Maneuver", CR, ' Display table heading
"-------- -------- --------", CR
#ENDIF
When the program is run as DATALOG_MODE = 1, word values are stored in EEPROM
with the
WRITE command. Figure 5-5 shows a map of each word. Each word value has
the
sensors variable copied to its .HIGHBYTE. Two nibbles are also copied to its
.
LOWBYTE. NIB1 gets the value of the state variable, and NIB0 gets the value of the
maneuver variable.
Figure 5-5
Datalogged Word
Variable
Two nibbles and a
byte are copied to
different parts of a
word variable before
it is copied to an
EEPROM address.
When
DEBUG_MODE is 1, the sensors, state, and maneuver variables are all stored to
EEPROM between each servo pulse. The best way to do this is by copying them to
different parts of a word variable, and then storing that word variable in EEPROM with a
WRITE command. As with the DEBUG_MODE = 1 code, the best place for the
DATALOG_MODE = 1 code is also at the beginning of the Servos_And_Sensors
subroutine.