
252
Part II: Advanced Hacks, Tools, and Techniques
Software Setup Instructions
After you have verified that power is going to the chips, it is time to pro-
gram the microcontroller inside the IR cannon and the hit-sensor board. I
chose the PIC16F876A controller, which is versatile and reasonably priced.
You will need to locate a programmer for this part; I used the ICD2 pro-
grammer/emulator from Microchip. A large number of companies offer
low-cost (less than $50) programmers on the Web. Do a quick search for
“PIC programmer” and ensure that the model you choose can program the
PIC16F876A (or whatever controller you use).
I wrote the control software for this hack in C to allow easy debugging. I
used the C2C compiler from http://www.picant.com/ as my C compiler. The
very efficient C2C compiler targets the PIC family of processors.
After you purchase a programmer,
download an evaluation copy of the
C compiler. Compile the code, and
then program the processor.
Software operation
The software looks for incoming IR
signals and generates outbound IR
cannon signals. A simple flowchart
illustrating the logic is shown in
Figure 13-13.
The IR cannon can be fired only
15 times, and the vehicle can take
only four hits before it becomes dis-
abled. Note that the four LEDs are
used for three different purposes;
the total number of hits will display
on the