Datasheet

Page 98ยท Applied Robotics with the SumoBot
uses RCTIME to measure and store the time it took for V
0
to decay to 1.4 V in a variable
named
temp:
HIGH 9
PAUSE 1
RCTIME 9, 1, temp
Remember that P10 has to be set high to turn on the QTI, and low to turn it back off
again when the measurement is done. With the use of
PIN directives to give each I/O pin
a name, the code should look about like this:
qtiPwrLeft PIN 10 ' Left QTI on/off pin
qtiSigLeft PIN 9 ' Left QTI signal pin
qtiLeft VAR Word ' Stores left QTI time
HIGH qtiPwrLeft ' Turn left QTI on
HIGH qtiSigLeft ' Discharge capacitor
PAUSE 1
RCTIME qtiSigLeft, 1, temp ' Measure charge time
LOW qtiPwrLeft ' Turn left QTI off
DEBUG CRSRX, 0, DEC5 qtiLeft ' Display time measurement
The rate at which the voltage decays is shown in Figure 3-11. When the QTI is over the
white tawara line that surrounds the sumo ring surface, lots of reflected IR makes it to the
IR transistor's base. In this situation, the IR transistor will conduct more current, and V
0
will drop very quickly. A typical
RCTIME value for this is 85, though it could range
anywhere between 15 and 350 depending on the surface and the ambient light in the
room. When the QTI is placed over the black sumo ring, the value might be 1500. That's
because the black surface absorbs infrared, and not nearly as much makes it to the base of
the IR transistor. With less IR striking its base, the transistor conducts less current, and
V
0
decays much more slowly.