a repeat, we ignore the key until it is released. This
instance of how the device is used shows this to be a
good feature to have. The de-bounce delay at Line 174
helps to mitigate any transient-caused switching.
Troubleshooting this design is pretty straightforward.
As with all troubleshooting, we will start with the most
likely culprits first:
1) Make sure the device is alive. The firmware is
designed so that when the device first powers up our LED
will illuminate. As soon as the main loop starts running,
that LED will extinguish. Not a fancy check, but it tells us a
great deal. It tells us that we have processed all of our
initialization code and that the main loop has started.
Further, we know that if we get a key hit, the LED will also
illuminate and extinguish after our key de-bounce time has
expired. So, if our LED doesn’t illuminate on power-up, we
PIC’s range of tolerance. If the LED doesn’t illuminate
when a key is pressed (key contact shorted), then we
need to check the key connections for opens or shorts,
i.e., use a multimeter to check voltages and resistances.
There is a possibility that the LED may blink when no keys
are pressed. This can occur for two basic reasons: a) The
power supply to our device is intermittent. This will cause
the PIC to reset and thus re-process our initialization
section of code; and b) There could be an intermittent
switch closure causing unwanted key presses.
2) Make sure the PC recognizes our device. In most
cases (99%+), computers should install the appropriate
drivers automatically. Some older PCs (Windows XP SP2
and prior, for example) may not have the correct drivers
present. They can be found on the Internet if this occurs.
After the driver installs, open Notepad, simple text, or
some other word processing tool. Click some keys (close
the key contacts) and you should see the defined scan
code key values show up on the screen. If you use the
defaults, they will be 0-9, a-d, <return>, and <backspace>.
If this doesn’t happen, check your device manager area
for the USB connected devices, and make sure the device
shows up in the list and has a driver installed. If it doesn’t,
you might need to search the Internet for drivers or check
the electrical connection to the USB port/device.
For Windows, there is a simple test application called
usbview.exe that will neatly show all connected USB
devices. There are other tools, but this one usually works
fine for Windows. Beyond making sure the drivers install
appropriately, I cannot give more detail relative to fixing
PC problems without doing a case by case review.
To sum it all up, my friend’s video game operates
without problems and the project has successfully fulfilled
its designed purpose. As a final note, it should be
mentioned that this project is exceptionally ideal for any
text input program on the computer and also for inputs to
satisfy special programs associated with racing event
monitoring, weather status, heat/cold or light/dark
monitoring, liquid or chemical, or for any other desired
input where outside world entry would be the medium.
There are plenty of modifications that can be made to
this basic design. Noise and transient voltage suppression
of the input switches could be added, should you choose
to use the design in a noisy environment such as in an
automobile or in an industrial control environment. You
could even modify the inputs to be Hall sensor or
photoelectric isolated switches.
The firmware could be modified to send words,
sentences, or timed outputs based on hold duration,
switch closure combinations, and so forth. As long as your
changes are within what the PIC documentation states is
allowable and you don’t violate the USB electrical or
communication standards, the possibilities are up to you.
32 November 2013
MADE IN THEUSA
B YPANAVISE PRODUCTS,INC.
A complete kit to go with this article can be purchased online from the
Nuts & Volts Webstore at www.nutsvolts.com or call our order desk at 800-783-4624.