Vous êtes sur la page 1sur 14

19

JOYSTICKS AND GAME PORTS

2
SYSTEM DATA AND TROUBLESHOOTING

CONTENTS AT A GLANCE Understanding the Game-Port System


Inside the joystick Adapting a second joystick Digital joysticks (game pads) Joystick calibration Joystick drift

Troubleshooting Joysticks and Game Ports


Joystick eliminator plug Adapting IDC connectors Sound cards and Y-adapter problems

Cleaning Joysticks Joysticks and Windows 95

Further Study

Few peripheral devices have come to represent PC entertainment like the joystick (Fig.
19-1). Although it is one of the simplest peripherals available for a PC, the joystick allows a user to bring an element of hand-eye coordination to interactive programs (i.e., flight simulators and 3D walk through games) that would simply be impossible with a keyboard or mouse. The joystick interfaces to the host PC through a board called the gameport adapter (or simply the game port). This chapter covers the joystick and game port, then covers a selection of service issues.

649

650

JOYSTICKS AND GAME PORTS

FIGURE 19-1

A general-purpose analog joystick. Suncom Technologies

Button detect circuit Position detect circuit Bus interface

FIGURE 19-2

Simplified diagram of a game-port system.

Understanding the Game-Port System


The typical game port uses a relatively simple interface to the PC. Only the lower 8 data bits are used (which explains why so many game ports still use the older 8-bit XT card style, rather than switching to a 16-bit AT card type). Also, only the lower 10 address bits are needed. Because the game port is an I/O device, the card uses I/OR and I/OR control signals. On virtually all PCs, port 201h is reserved for the game port. Figure 19-2 illustrates a typical game-port system.

INSIDE THE JOYSTICK


Each analog joystick is assembled with two separate potentiometers (typically 100 k) arranged perpendicularly to one anotherone potentiometer represents the X axis, and the other potentiometer represents the Y axis. Both potentiometers are linked together me-

UNDERSTANDING THE GAME-PORT SYSTEM

651

chanically and attached to a movable stick. As the stick is moved left or right, one potentiometer is moved. As the stick moves up or down, the other potentiometer is moved. Of course, the stick can be moved in both the X and Y axis simultaneously, with the proportions of resistance reflecting the sticks position. You can see the wiring scheme for a standard 15-pin dual joystick port in Fig. 19-3. The pinout for a standard joystick port is listed in Table 19-1. Detecting the sticks X and Y position is not an intuitively obvious process. Ultimately, the analog value of each potentiometer must be converted to a digital value that is read by the application software. This is an important wrinklebecause the game port does not generate an interrupt, it is up to the particular application to interrogate the joystick port

2
SYSTEM DATA AND TROUBLESHOOTING

15

FIGURE 19-3

Wiring diagram for a dual joystick port.

TABLE 19-1 PINOUT FOR A STANDARD JOYSTICK PORT 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 XY1 (Joystick 1 +5-V supply) Switch 1 Potentiometer X1 Ground (for switch 1&2) Ground (for switch 2) Potentiometer Y1 signal Switch 2 N.C. (or +5 V) XY2 (Joystick 2 +5-V supply) Switch 3 Potentiometer X2 signal Ground (for switch 3&4) Potentiometer Y2 signal Switch 4 N.C. (or +5 V)

* The standard game port uses a DB15 female connector.

652

JOYSTICKS AND GAME PORTS

regularly. You might imagine that such a conversion would use an Analog-to-Digital Converter (ADC). However, an ADC provides much greater resolution than is needed and its conversions require a relatively long time. Current game-port conversion circuits use a multivibrator element. Ultimately, the resistance of each potentiometer is determined indirectly by measuring amount of time required for a charged capacitor to discharge through the particular potentiometer. If a certain axis is at 0 , the multivibrators internal capacitor will discharge in about 24.2 s, and at 100 k, the multivibrators capacitor will discharge in about 1124 s. Because this is a relatively linear relationship, the discharge time can easily be equated to potentiometer position (an actual routine to accomplish this requires only about 16 lines of assembler code). The multivibrator technique also simplifies the circuitry needed on the game-port adapterit is really the application that is doing the work. A joystick also has one or two buttons. As you see from Fig. 19-3, the buttons are typically open, and their closed state can be detected by reading the byte at 201h. Because the game port is capable of supporting two joysticks simultaneously (each with two buttons), the upper four bits of 201h indicate the on/off status of all four buttons.

ADAPTING A SECOND JOYSTICK


Although the typical game port is capable of supporting two joysticks, most joystick products only connect a single joystick. This means that only half the game port is being utilized. You can purchase a joystick Y-adapter from any computer store or construct a Y-adapter using the pinout in Table 19-2. Youll need a DB-15 male connector to attach to the game port and two DB-15 female connectors to attach to each of the two joysticks.
TABLE 19-2 PINOUT FOR A JOYSTICK Y ADAPTER GAME PORT DB-15 MALE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 XY1 (joystick 1 +5-V supply) Switch 1 Potentiometer X1 signal Ground (for switch 1&2) Ground (for switch 2) Potentiometer Y1 signal Switch 2 N.C. (or +5 V) XY2 (Joystick 2 +5-V supply) Switch 3 Potentiometer X2 signal Ground (for switch 3&4) Potentiometer Y2 signal Switch 4 N.C. (or +5 V) JOYSTICK 1 DB-15 FEMALE 1 2 3 4 5 6 7 8 1 2 3 4 and 5 6 7 8 JOYSTICK 2 DB-15 FEMALE

UNDERSTANDING THE GAME-PORT SYSTEM

653

Directional control

Fire buttons

2
FIGURE 19-4 A typical Nintendo-style digital joystick.
SYSTEM DATA AND TROUBLESHOOTING

Some types of game-port boards provide a separate 15-pin connector for each joystick. Some cut-price game-port boards only provide one connector and the circuitry for one joystick. Verify the capabilities of your game port before using or replacing a joystick Y-adapter.

DIGITAL JOYSTICKS (GAME PADS)


Where an analog joystick uses two potentiometers to provide linear information about the joysticks relative position, a digital joystick (also called a game pad) simply uses an array of switches to indicate absolute directionusually up, down, left, right, and fire (Fig. 19-4). The game pad actually pre-dates the analog joystick a bit and uses a 9-pin TTL interface as illustrated in the Amiga-style game pad (Table 19-3). Current versions of the digital joystick (such as the Gravis GamePad Pro) use a 15-pin PC game-port interface. This book will not go farther with game-pad control devices, but you should at least understand how they compare to analog joysticks.
9-pin game pad-type joysticks are not directly compatible with the PC analog game port, and you should not attempt to adapt a 9-pin game pad to a 15-pin PC game port without some appropriate interface circuitry. Game pads specifically marked as PC joystick compatible (using 15-pin connectors) can usually be attached to ordinary game ports without problems.

JOYSTICK CALIBRATION
Unfortunately, these values of time versus resistance are not the same for every system. Variations in joystick potentiometers, game-port adapter circuits and computer speed will all affect the relationship of time-vs.-resistance value. Even variations in component temperature as the PC warms up can cause changes in resistance interpretation. This is why

654

JOYSTICKS AND GAME PORTS

TABLE 19-3 PINOUT FOR AN AMIGA-TYPE GAME PAD PIN 1 2 3 4 5 6 7 8 9 GAME PAD Forward Back Left Right n/c Button (fire) 1 +5 V Ground Button (fire) 2

* Game pads often use a DB-9 female connector.

each application program that uses a joystick comes with a calibration routine. Calibration allows the application to measure values for center and corner positions. With this data as a base, the application can extrapolate all other joystick positions.

JOYSTICK DRIFT
The term drift (rolling) is used to indicate a loss of control by the joystick. There are several possible reasons for this. As a technician, you should understand the reasons why drift occurs, and how to correct such problems. First, drift might be the result of a system conflict. Because the game port does not generate an interrupt, conflicts rarely result in system crashes or lockups, but another device feeding data to port 201h can easily upset joystick operation. If you have sound boards or multi-port I/O boards in your system equipped with game ports, be sure to disable any unused ports (check with the user instructions for individual boards to disable extra game ports). Another possible cause of drift is heat. Once PCs are started up, it is natural for the power used by most components to be dissipated as heat. Unfortunately, heating tends to change the value of components. For logic circuits, this is typically not a problem, but for analog circuits, the consequences can be much more pronounced. As heat changes the values of a multivibrator circuit, timing (and thus positional values) will shift. As the circuit warms up, an error creeps into the joystick. Well-designed game-port adapters will use high-quality, low-drift components that minimize the affects of heat-related drift. It is interesting that the joystick itself is rarely the cause of drift. If you can compensate for drift by periodically re-calibrating the joystick, try a better-quality game-port adapter board. Finally, the quality of calibration is only as good as the calibration routine itself. A poor or inaccurate routine will tend to calibrate the joystick incorrectly. Try another application. If another application can calibrate and use the joystick properly, you should suspect a bug in the particular application. Try contacting the application manufacturer to find if there is a patch or fix available.

JOYSTICKS AND WINDOWS 95

655

Cleaning Joysticks
Ordinarily, the typical joystick should not require routine cleaning or maintenance. Most joysticks use reasonably reliable potentiometers that should last for the life of the joystick. The two major enemies of a joystick are wear and dust. Wear occurs during normal use as potentiometer sliders move across the resistive surfaceit cant be avoided. Over time, wear will effect the contact resistance values of both potentiometers. Uneven wear will result in uneven performance. When this becomes noticeable, it is time to buy a new joystick. Dust presents another problem. The open aperture at the top of a joystick is an invitation for dust and other debris. Because dust is conductive, it can adversely affect potentiometer values and interfere with slider contacts. If the joystick seems to produce a jumpy or non-linear response to the application, it might be worth trying to clean the joystick, rather than scrapping it. Turn off the computer and disconnect the joystick. Open the joystick that is usually held together by two screws in the bottom housing. Remove the bottom housing and locate the two potentiometers. Most potentiometers have small openings somewhere around their circumference. Dust out the joystick area with compressed air and spray a small quantity of good-quality electrical contact cleaner into each potentiometer. Move the potentiometer through its complete range of motion a few times and allow several minutes for the cleaner to dry. Re-assemble the housing and try the joystick again. If problems persist, replace the joystick.

2
SYSTEM DATA AND TROUBLESHOOTING

Joysticks and Windows 95


Games have traditionally been a domain of DOS, so there has been little support for joysticks under Windows. However, now that games are routinely using Windows 95 (taking advantage of such features DirectX and Direct3D), you can now install and calibrate a variety of joysticks under Windows 95. Open your Control panel and look for the Joystick icon. If the Joystick icon appears in your Control panel, joystick support is already installed and you can skip to the Game controller setup. If you have not yet added your PC game port as New hardware in the Windows 95 Control panel, you should do this first:
1 Click the Start button. 2 Select Settings, then Control panel. 3 In the Control panel, look for a Joystick icon. If its there, skip to the Game controller

4 5 6 7

setup. If not, doubleclick the Add new hardware icon to start the Add new hardware wizard. When prompted to have Windows search for new hardware, select No. Click Next to continue. Select Sound, video and game controllers, then click Next. Select the Manufacturer and game port joystick (or other appropriate model). This will add the game port as a device. Click Next. If resource settings are given as 0201-0201, click Next. Windows will look for the required files. If it cant find these files, it will ask you to insert your Windows 95 CD or disk.

656

JOYSTICKS AND GAME PORTS

8 When the files have been installed, click Finished. 9 Shut down your computer and restart Windows 95 to enable your game-port support.

Once your game-port driver has been added, a joystick icon appears in your Control panel. Use this to set up and calibrate your joystick:
1 Doubleclick the Joystick icon in the Control panel. 2 In the Joystick configuration section, choose the appropriate joystick type from the list. 3 After selecting your joystick configuration, click the Calibration button and carefully

follow the onscreen instructions. You should not be able to use the joystick under any Windows 95 game or other joystick-aware application.

Troubleshooting Joysticks and Game Ports


The unique advantage to troubleshooting this area of a PC is that there is surprisingly little to actually go wrong. In virtually all cases, problems reside in either the joystick, the game-port adapter, or the application software. This part of the chapter provides you with some handy troubleshooting issues and examines a suite of perplexing joystick problems.
You can use the CALJOY22.ZIP and JOY2.EXE programs on the companion CD to aid you with testing and calibrating joysticks.

JOYSTICK ELIMINATOR PLUG


From time to time, you might find yourself testing a game port, but have no joystick handy (or it might be too much of a hassle to borrow a joystick already connected to a working PC). You can construct a very simple circuit with two resistors (Fig. 19-5) that can fool the game port into thinking that a real joystick is attached. This joystick eliminator plug simply places the cursor in a far corner of the display.
5V 1 9 x y FIGURE 19-5 Both resistors 100 k 8 15 A simple joystick eliminator plug for game-port testing.

TROUBLESHOOTING JOYSTICKS AND GAME PORTS

657

TABLE 19-4 PINOUT FOR A SOUND BOARD JOYSTICK CABLE ADAPTER DB-15 MALE (TO GAME PORT) Wire pin . . . 1 2 3 4 5 6 7 8 9 10 11 12 unused 13 14 15 unused DB-15 FEMALE (TO JOYSTICK Y-ADAPTER) to pin(s) . . . 1 2 3 4 5 and 12 6 7 8 9 and 15 10 11 to pin 5 13 14 to pin 9

2
SYSTEM DATA AND TROUBLESHOOTING

ADAPTING IDC CONNECTORS


Some multi-I/O boards implement the game port as a 16-pin IDC (ribbon cable) connectorassuming that youll use a DB-15 connector plate in another open card slot and simply connect the DB-15 plate to the multi-I/O card using a 16-pin ribbon cable. The pin assignments are all identical (pin 16 of the IDC connector is just left unused), but remember that the pin order is different between IDC and DB-style connectors. For example, the top row of a DB-15 connector runs pins 9 through 15, but the top row of an IDC cable uses pins 2, 4, 5, 6, 10, 12, 14, and 16.

SOUND CARDS AND Y-ADAPTER PROBLEMS


You will probably encounter difficulties when connecting commercial joystick Yadapters to the game port on a sound board. This is because many sound-card manufacturers (such as Creative Labs) have replaced pins 12 (ground for joystick 2 switches 3 and 4) and 15 (N.C. or +5 V) with specialized MIDI interface pins. The problem doesnt surface using a single joystick because pins 12 and 15 are normally unused. But when a second joystick is added through a Y-adapter, the second joystick will probably fail to function. Table 19-4 illustrates a simple correction to enable a commercial Y-adapter. Essentially, you must disconnect pins 12 and 15 at the game-port (sound board) end, then cross-wire pin 12 to pin 5 (ground), and cross-wire pin 15 to pin 9 (+5V). If you want to make your own sound-board compatible Y-adapter, follow the pinout in Table 19-5.

658

JOYSTICKS AND GAME PORTS

TABLE 19-5 PINOUT FOR A SOUND BOARD COMPATIBLE JOYSTICK Y-ADAPTER GAME PORT DB-15 MALE Wire pin . . . 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 JOYSTICK 1 DB-15 FEMALE To pin . . . 1 2 3 4 5 6 7 8 JOYSTICK 2 DB-15 FEMALE And to pin . . . 1

XY1 (Joystick 1 +5-V supply) Switch 1 Potentiometer X1 signal Ground (for switch 1&2) Ground (for switch 2) Potentiometer Y1 signal Switch 2 N.C. (or +5V) XY2 (Joystick 2 +5V supply) Switch 3 Potentiometer X2 signal MIDI Potentiometer Y2 signal Switch 4 MIDI

4 5

8 2 3 unused 6 7 unused

Do not attempt to connect a MIDI device to the sound card while this modified Y-adapter is in place. Doing so can easily damage the MIDI device or the sound cards MIDI/game port. Symptom 19-1. The joystick does not respond Be sure that the joystick is plugged into the game port correctly. When the game port has more than one connector, be sure that the joystick is plugged into the correct connector (joystick 1 or joystick 2). If the game port is running through a sound board, be sure that the sound board is configured to use the port as a game port instead of a MIDI port and see that any joystick Y-adapter is wired properly. Refer to the application and see that it is configured to run from the joystick (if mouse or keyboard control is selected, the joystick will not function). Now that many new joysticks are appearing with supplemental functions (i.e., hat switches, throttle controls, etc.), be sure that the application is written to take advantage of the particular joystick. If problems persist, be sure that the game port is set for the proper I/O address (most are fixed at 210h, but check the user documentation to be sure). Try a known-good joystick with the game port. If a known-good joystick works, the original joystick is defective and should be replaced. If another joystick is not the problem, try a different game-port board. Joystick performance is erratic or choppy Start by checking the joystick to be sure that it is connected properly. Try another joystick. When a new joystick works properly, the original joystick is probably damaged and should be replaced. If a new joystick fails to solve the problem, the game-port board might be too slow for the system. Remember that many game ports still use XT board types. An older board design Symptom 19-2.

TROUBLESHOOTING JOYSTICKS AND GAME PORTS

659

might not be able to process joystick signals fast enough to provide adequate signaling to the system. Not only should you try another game-port adapter, but you should use a speed-adjusting game port.
Symptom 19-3. The joystick is sending incorrect information to the systemthe joystick appears to be drifting First, check the application to be sure

that the joystick is calibrated correctly. If you cannot calibrate the joystick, the application might not support the joystick properlytry another application. Be sure that there are no other active devices in the system (such as other game ports) using I/O port 201h. If this happens, data produced on those other boards will adversely affect the game port that you are using. If all unused game ports are disabled, check the active game port. Poor-quality game ports can drift. Try a newer, low-drift or speed-adjusting game-port board.
Symptom 19-4. The basic X/Y, two-button features of the joystick work, but the hat switch, throttle controls, and supplemental buttons do not seem to respond In virtually all cases, the joystick is configured wrong. Check the

2
SYSTEM DATA AND TROUBLESHOOTING

application firstmany new applications provide several different joystick options, and even allow you to define the particular use of each feature from within the application itself. Check the joystick definition files next. Your joystick probably requires a supplemental definition file (i.e., an .FCS file) to use all of the joysticks particular features. Finally, check the game-port type. You might need a dual-port game-port adapter, rather than an inexpensive single-port game-port adapter. Some enhanced joysticks use both joystick positions (i.e., the XY axis and fire buttons make up one joystick, and the throttle and other buttons take up the other position). You might need to install a dual-port game-port card.
Symptom 19-5. A Joystick not connected error appears under Windows 95 Windows 95 does not recognize the game-port hardware. Check the game-

port driver first. Use the Device manager under Windows 95 to examine the resources assigned to the game-port driver. Typically, the resource range should be set to 201h through 201h (only one address location). If the game-port entry has a yellow icon next to it, there is a hardware conflict in the system, and other hardware is also trying to use the same I/O location. Next, check the game-port hardware for proper configuration. The game-port card should be installed properly into its bus slot. Be sure that the game port is enabled (this is typical of game ports integrated onto sound cards or multi-I/O cards). If a sound card enables you to switch a 15-pin port between MIDI and joystick, see that the jumper is set to the joystick position. Be sure that the joystick cable is not cut or damaged anywhere, and see that it is attached securely to the game port. Finally, test a known-good joystick on the system. If a new joystick works as expected, the original joystick is probably suffering from internal wiring damage.
Symptom 19-6. The joystick drifts frequently and requires recalibration

This type of symptom is usually the result of problems with the game-port adapter. Try a different game-port adapter and see if the problem persists. If problems disappear, you

660

JOYSTICKS AND GAME PORTS

simply need a better-quality or speed-adjusting game port. Otherwise, test a known-good joystick on the system. If a new joystick works as expected, the original joystick is probably suffering from internal wiring damage and should be replaced.
Symptom 19-7. The joystick handle has lost tensionit no longer snaps back to the center This problem might be accompanied by a rattling sound

within the joystick. In most cases, a spring has popped out of place inside the joystick. Check the joystick for internal damage. Open the joystick and see if any springs or clips have slipped out of place. Replace any springs or clips (if possible). Some joysticks also use mechanical latches that can enable or disable the spring action of the X and Y axis. Check to see that any such latches are enabled. If you cannot locate or correct the problem, simply replace the joystick outright.
Symptom 19-8. The joystick responds, but refuses to accept a calibration In virtually all cases, the problem is with your game-port adapter. Check the hard-

ware setupbe sure that there are no other devices in the system using the I/O address assigned to your game port (i.e., 201h). If more than one adapter in your system has game-port capability, see that only one game port is enabled. Replace the game port, or enable a different game port in the system. If drift issues continue with different applications, you might need to replace the game-port adapter with a low drift or speed-adjusting model.
Symptom 19-9. The hat switch and buttons on a joystick work only intermittently (if at all) This problem also applies to stand-alone pedals. In most cases,

erratic behavior of a joysticks enhanced features is a symptom of game-port speed problems. Check the joystick first. Try a known-good joystick. If the problems disappear, the original joystick might in fact be defective. If the problems persist, you have a game-port problem. Be sure that there are no other devices in the system using the I/O address assigned to your game port (i.e., 201h). If more than one adapter in your system has game-port capability, see that only one game port is enabled. If drift issues continue with different applications, you might need to replace the game-port adapter with a low drift or speed-adjusting model.
Symptom 19-10. When downloading FCS (or calibration) files to a joystick, the line saying: Put switch into calibrate doesnt change when the download switch is moved This is a typical problem with advanced joysticks.

In most cases, the joystick needs to be cleared. Clear the joystickrock the download switch back to analog, then to calibratethis should clear the joystick for a new calibration download. Try downloading the FCS file again. If problems persist, the actual switch might be defective. Try a known-good joystick instead.
Symptom 19-11. To download a calibration file, you need to rock the red switch back and forth a number of times (or hit the <Enter> key a number of times) to get it to 100% This is virtually always the result of a keyboard-con-

troller (keyboard BIOS) compatibility problem. Upgrade the keyboard controller (keyboard BIOS). Some advanced joystick products do not interact well with the host

TROUBLESHOOTING JOYSTICKS AND GAME PORTS

661

computers keyboard controller. For example, Thrustmasters Mark II experiences known microcode problems with a few of keyboard controller chips on the market. These include AMI versions (D, B, 8, 0), Acer, and Phoenix. You might need to replace the keyboard controller with a later version.
Symptom 19-12. A joystick cannot be used with a PC using a sound card with an ESS or OPTi chipset The joystick might stop responding while using an ap-

plication or report a not connected status in the game controllers area of the Control panel. This is a known problem with the ESS and OPTi sound chipsets. Youll need to set Single-mode DMA to use the joystick: Start, select Settings, then click Control panel. Doubleclick Multimedia. On the Advanced tab, doubleclick the Audio devices entry to expand it. Click the Audio for... entry that corresponds to your particular sound card, the click Properties. 5 Click Settings. 6 Click the Use single-mode DMA check box to select it. 7 Click OK until you return to Windows, then restart the PC.
1 2 3 4 Symptom 19-13. The joystick port is not removed when the sound card is removed The entry for your game port will still be visible in the Windows 95 Device

2
SYSTEM DATA AND TROUBLESHOOTING

manager. This is not really a problemWindows 95 does not recognize the game port as being part of the sound card, so removing the sound card doesnt automatically disable the game port. Also, the virtual joystick device driver (VJOYD.VXD) cannot detect whether the game port or joystick is installed so that the driver is always active. Youll need to manually remove the game port in Device manager:
1 2 3 4 5

Use the right mouse button to click My computer, then click Properties on the menu. Click the Device manager tab. Doubleclick the Sound, video, and game controllers entry to expand it. Click the joystick port, then click Remove. Return to Windows 95 and restart the system.

Symptom 19-14. The jumperless joystick port cannot be disabled This issue frequently crops up with newer sound cards, such as the Ensoniq VIVO, and jumperless boards are controlled exclusively through drivers. The VIVO also uses drivers to disable certain functions, such as the joystick port. Use the following steps to disable the VIVOs joystick port (the specific command lines for your own sound board might be different, but the idea is very similar): 1 Leave Windows 95 and enter the MS-DOS mode. 2 Edit the SNDSCAPE.INI file in the \Windows directory. Change the line JSEnable

=true to JSEnable=false (check your particular sound boards documentation for the correct command line). 3 Save the file and reboot the system. The joystick will now be disabled.

662

JOYSTICKS AND GAME PORTS

Further Study
Thats all for Chapter 19. Be sure to review the glossary and chapter questions on the accompanying CD. If you have access to the Internet, take a look at some of these joystick and game-port resources: Advanced Gravis: http://www.gravis.com Logitech: http://www.logitech.com Thrustmaster: http://www.thrustmaster.com CH Products: http://www.chproducts.com

Vous aimerez peut-être aussi