Datasheet

Chapter 3: EEPROM Tricks and Program Tips · Page 131
Figure 3-22 shows an example of how these modified routines display the contents of the
sensors byte. But first let’s look at this line for a moment:
DEBUG CRSRXY, 0, 4, BIN8 sensors
DEBUG CRSRXY, 0, 4, places the Debug Terminal cursor at column 0, row 4 (the top
row is row 0) right inside the display heading built by the Initialization
DEBUG command.
BIN8 sensors displays the value of sensors as an 8-digit binary number, allowing us
to view each bit, and therefore the status of each sensor’s I/O pin
.
The bit pattern in Figure 3-22 indicates that the left and right front IR detectors see an
object, making it a good time for your SumoBot to lunge forward. In the next chapter,
your programs will examine this variable, sometimes for patterns, and other times for
changes in certain groups of bits.
Figure 3-22
The sensors Byte
The left front (LF) and
right front (RF)
infrared object
detectors (IROD)
have detected
objects
Save SensorsWithFlagsByte.bs2 as SensorsByteDisplay.bs2.
Replace the Initialization and Main Routine with the ones above.
Save and run the program.