This is only a preview of the June 2001 issue of Silicon Chip. You can view 33 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Articles in this series:
Items relevant to "A Fast Universal Battery Charger":
Items relevant to "Phonome: Call, Listen In & Switch Devices On & Off":
Items relevant to "Using Linux To Share An Internet Connection; Pt.2":
Items relevant to "Li'l Snooper: A Low Cost Camera Switcher":
Items relevant to "A PC Games Port Tester":
Purchase a printed copy of this issue for $10.00. |
When you plug a game controller or joystick into the games
port on your PC and fire away, something should happen!
But if it doesn’t, what’s to blame: the games port, the games
controller/joystick or perhaps even the software?
This simple Games Port Tester will at least tell you
whether the port itself is OK. It’s simple to make,
simple to use and will cost next-to-nothing to build.
Design by Trent Jackson
T
his Games Port Tester, or GPT,
is arguably the simplest possible way to check to see if the
games port is functioning correctly.
Initially, the project was created to
test and experiment with the quality
and accuracy of the games ports on
various low-cost sound cards. But it is
just as happy testing the games ports
80 Silicon Chip
which are fitted to most PCs.
It will test both sides of the port –
Player 1’s “X” and “Y” axes and fire
buttons and similarly Player 2’s “X”
and “Y” axes and fire buttons. This
is accomplished by simply flicking
a switch.
The software written to suit this
project features an auto calibration
control and toggle control between
both players, along with smooth,
sprite-free graphic movement on the
100K and 200K systems.
What’s in a games port?
The games port is more or less just
a resistance-measuring device.
Normally, a joystick is connected
to the games port. Inside the joystick
are two potentiometers, or variable
resistors, which adjust as the joystick
is moved. One pot is assigned to the X
(horizontal) axis and the other to the
Y (vertical) axis.
Change the resistance in the X-axis
(by moving the joystick back and forth)
and the cursor (if there is one) moves
across the screen. Change it in the
Y-axis and the cursor moves up and
down the screen.
Change both at the same time and
the cursor moves at an angle across
the screen.
The games port interprets the X- and
Y-axis movement, the speed and the
distance. It then feeds this information
to the software being used at the time
and the software makes use of this
information as it requires.
The other part of the joystick is the
“fire” button which, as you have probably guessed, simply closes a switch.
Again, the games port detects this and
causes an action within the software
running at the time (not surprisingly,
usually some sort of weapon firing!).
Games Port Tester – Block Diagram
The GPT
move to the left, again in proportion
to the initial value.
The same applies to the Y-axis, except that movement will occur in the
vertical direction – up and down the
Because a games port is such a simple device, a games port tester can also
be very simple.
All you need are two variable resistors to check the X- and Y-axes and
a pair of push-button (momentary
action) switches to check the firing.
In addition, we include a DPDT,
centre-off switch which is used to
toggle between Player 1 input and
Player 2 inputs.
So as you can see the GPT is a very
simple device, at least hardware-wise.
The software is a slightly different
story. It has to be able to detect the
varying resistances in each axis as well
as the push-button positions.
Let’s assume that the variable resistor which controls the X-axis is
rotated clockwise. This will cause
the resistance value being seen by the
games port to increase, thus causing
the software to move the circle on the
grid to the right, in proportion to the
to the initial value of the resistance.
Now if that same resistor is rotated
anti-clockwise, the resistance value
being returned to the port will decrease. Thus the circle on the grid will
screen, as the resistance is increased
and decreased.
Testing the games port then involves
comparing the X and Y-axes values
that the software prints on the screen
A look inside the Games Port Tester.
All wiring is point-to-point; that is, no
PC board or other support is required.
June 2001 81
Three switches,
four diodes and
two pots make up
the games port
tester.
and checking to see how stable the circle graphic is in movement by rotating
the X and Y knobs on the GPT.
The value shown on the screen is
directly proportional to the value of
resistance, within a tolerance of about
10%.
Construction
All wiring is point-to-point due to
the minimal number of components
involved. Start by drilling the holes
in the jiffy box for the two pots and
three switches. The pots mount on the
lid of the box, the two pushbuttons on
each side and the toggle (changeover)
switch on the end.
At the opposite end of the box you’ll
need a 10mm hole for the 2m long,
9-conductor cable which connects
to the D-15 plug. It’s a good idea to
strip this cable and fit it before fitting
anything else, as everything basically
wires to this cable. Strip off around
200mm of outer insulation and fit a
cable tie to the cable at the point it
exits the box to make it captive. A
grommet fitted to the cable prevents
wear and tear.
If you don’t have a short length of
red wire to connect the two “hot” ends
of the pots together, you might have
to strip off, say, another 60mm and
sacrifice the other colours.
By the way, when we say 9-conductor
cable there are actually ten conductors,
one being the braid or shield (earth).
9-conductor shielded cable may not
be all that easy to obtain – Altronics
have it (Cat W-2712), as do Jaycar (Cat
WB-1578). But if you have to, you could
use 12-core and ignore three.
If you use similar-sized push buttons to those used in the prototype
you will find that they nearly touch
when fitted. This makes them a handy
mounting point for the four diodes,
which connect between the switches
and the D-15 wiring, in all cases with
the cathodes (striped end) towards
the switches. The anode ends solder
direct to the wires with nothing else
to support them.
A link connects one pole of each
pushbutton switch, with the shield of
the cable (earth) also connected to this
link. If there is any danger of the shield
shorting to another wire or component,
fit a short length of insulation over it
first. The same comments apply at
the other end of the cable (ie, at the
D-15 plug).
Parts List Games Port Tester
1 Jiffy box, 68 x 130 x 43mm
1 label to suit
2 SPST momentary-action (push
on) push button switches
1 DPDT centre off miniature
toggle switch
2 metres 9-core shielded cable
1 D-15 male connector
1 D-15 backshell
2 large knobs (25 to 30mm diameter) with flat surfaces
2 knob labels, “X” and “Y”
1 grommet
3 small cable clamps
2 10mm lengths spaghetti insulation or heatshrink tubing
Semiconductors
4 1N914 small signal silicon
diodes
A close-up of the “business end” of the tester, showing the four diodes soldered
directly to the pushbutton switches and the wiring back to the D-15 plug
soldered to these. The big red thing is a piece of insulation over the cable braid.
82 Silicon Chip
Resistors
2 100kΩ linear potentiometers
Follow this wiring
diagram and you
shouldn’t have any
problems building the tester. The
numbers refer to the
pin numbers of the
D-15 plug. At right
are the four labels
you’ll need to glue to
the box and knobs.
The label at top is for
a floppy disk if you
want it. It’s best to
photocopy these!
Using the wiring diagram as a
guide, solder the various components
and wires in place. Cut the various
wires to appropriate lengths and bare
only the last 5mm or so to minimise
the likelihood of shorts. Be especially
careful around the changeover switch.
A couple of cable ties can hold
the various conductors together and
make for a neater job.
After checking that your wiring
is OK, fit the lid to the box and glue
the label in place. It covers over the
Here’s the almost-assembled D-15
plug. All that remains is to fit the
top cover and screw the two halves
together. The cable clamp is the
metal fitting immediately before the
cable exits the backshell. Also note
the insulation (heatshrink) fitted to
the earth braid.
screw holes - hopefully you won’t
have to open the box up again. By
the way, we use 3M “repositional
spray adhesive” to fix paper labels
to boxes. Fit the large knobs and the
internal assembly is complete.
The D-15 plug
If we said be careful soldering to
the changeover switch, be doubly
careful with the D-15 plug. There
is very little space between the pins
and it’s easy to have one strand of
copper bridge out two pins. This
will not only stop your GPT working; it could actually damage your
computer. And you wouldn’t want
that, would you!
Again, follow the wiring diagram
very carefully to ensure that you
have the right colour wire going to
the right colour pin. As we mentioned before, you should slip a
length of insulation over the earth
braid to make sure it cannot short
to other pins.
When you have completed wiring
the plug - and double checked that
you haven’t any shorted pins - it’s
time to assemble it into its “backshell”. First of all, fit the cable clamp
June 2001 83
Even if you don’t understand BASIC, you can get a good idea of how the software works
by following this flowchart and comparing it with the relevant lines of code in the listing.
You can download the BASIC from www.siliconchip.com.au
Testing
as shown in the photograph - it does
nothing except provide strain relief
for the cable.
Then drop the plug into one half of
the backshell, pushing it down into
its position so that the lip on the front
of the backshell holds it in place. The
strain-relief clamp you fitted before
occupies a place near where the cable
emerges from the shell.
There are two “captive” screws
which are used to hold the plug in the
PC socket. These are sometimes a pain
to fit because one wants to fall out as
you fit the other one! The trick is to
fit the other half of the backshell, then
open each side up again just slightly
while you push the screws through
into place.
You will note that each half of the
backshell is identical with a round
hole and a hex hole. This means that
one of the backshell securing screws
goes in from one side, with its hex nut
on the other side, and the other screw
goes the opposite way around. Actually that hex hole is handy because it
holds the nut without pliers or a nut
driver - all you need is a screwdriver.
84 Silicon Chip
Assuming you have checked
everything twice, plug the GPT into the
games port on the computer and turn
your computer on. Of course, you’ll
need to run the software (joytest1.
exe). When you do, you should see a
red circle somewhere on a green grid.
Now you need to calibrate the software to your hardware by centring the
circle to the cross on the grid. Adjust
the two pots to the centre position,
then press any key to finish the calibration process.
With proper calibration, the red circle should be very close to the centre
cross on the grid. If not, repeat the
calibration.
Now assuming that all is well, you
should be able to rotate the X and Y
knobs and be presented with a moving
circle across the grid, in proportion
to the movement of the knobs. If the
games port is operational you should
be able to move the circle to all four
corners of the grid by combining the
X and Y co-ordinates. On-screen in-
structions explain all the various key
functions so use should be reasonably
straightforward.
The software
The software is written in BASIC
language and, as such, it is quite easy
to follow. To assist you further, most
of the lines have remarks to explain
their function. Both the source code
(.BAS) and executable (.exe) files can
be downloaded from the SILICON CHIP
website (www.siliconchip.com.au),
As well as checking out the games
port, reading through the BASIC file is
an excellent way to learn a little about
the BASIC language and how to move
graphics in the BASIC language with
minimal flicker and without the need
to create and use sprite graphics. It’s
also an great way to learn more about
the various features and functionality
of the games port on your PC, a port
which often gets little use and is even
less understood.
Who knows, you could develop an
SC
even better way to use it!
To learn more about PC Games Ports, refer to the series of articles "Experiment with
Games Ports”published in SILICON CHIP between January 1992 and November 1994
(not in every issue!) Most of 1992 issues are now sold out but reprints can be supplied. Refer to the index pages of the SILICON CHIP website for months of appearance.
|