computer interfacing tutorial-printer, serial, game, usb port
 

 

NEXT

6.1. Introduction To Game Port/ Joy Stick

Nowadays the most common analogue joystick type is PC analogue joystick. This joystick model was presented by IBM together with their first IBM PC computer. The joystick is just a basic analogue joystick with two buttons. The original joystick interface had circuit for connecting two joysticks, but had only one joystick connector. A special Y-cable was needed if there was need for two joysticks at the same time. Later time some manufacturers put two connectors to their interface card and some card manufacturers implemented only one joystick input. Fortunately most of the card nowadays have option for two joysticks like the original IBM joystick card.

The joystick interface card was designed to be as simple and cheap as possible. The card consisted only of bus interface electronics and four monostable multivibrators (all in on 558 chip). Those monostable multivibrators were simple timer circuits which put out a pulse with width directly proportional to the joystick resistance value. The pulse width was then measured using software loop. This has caused anormous amounts of problems to game programmers when computers have become faster and faster all the time. On faster machines, the joystick routine in the software does not read the joystick signal properly resulting in a timing problems. Some dedicated joystick cards are designed to vary the joystick signal so the software can properly detect the joystick and process the data.

Joystick construction
The joystick consists of two potentiometers with variable resistance value between 0 Ohm and 100 kohm (in some joysticks up to 150 kohm). The potentiometer resistances have the minimum values when the joystick is at the top left position. One end of the potentiometer is connected to +5V pin and the center pin is connected top the analogue input of the joystick. The other end of the potentiometer is left not connected to anywhere.

There are two commonly used ways how PC analogue joystick stick mechanism is constructed. Some joystick convert the stick position to linear motion, whcih then changes the position of the slider in about 100 kohm linear potentiometer. More popular construction is to use normal axial potentiometers and the joystick movement directly turns those potentiometers. Some joystick used special 100 kohm potentiometer which can only turn that 60..90 degrees which joytick can turn. The more common construction is to use the standard 470 kohm (lin) 270 degree potentiomer and use about one fourth of the scale from the beginning (in this way getting 0..120 kohm value range). Usually those potentiometers are normal carbon slider potentimeters which do not last long in intense gaming.


Joystick connector

NO
PURPOSE
1
XY1 (+5v)
2
Switch 1
3
X1
4
Ground (for switch 1)
5
Ground (for switch 2)
6
Y1
7
Switch 2
8
N.C.
9
XY2 (+5v)
10
Switch 3
11
X2
12
Ground (for switch 3&4) *
13
Y2
14
Switch 4
15
N.C. *

Some I/O cards have implemented only the first joystick functions: X1, Y1, Switch 1 and Switch 2. Some joystick adapter have +5V output also in pin 8.

* Many soundcards have joystick interfaces with midi port function enbedded to the same connector. Those midi port impelemtations use pins 12 (midi data output from computer) and 15 (midi data input to computer). The midi cable includes the necessary electronics for signal conversion and isolation. That's a nonstandard way of using the pin and it may cause problems in some cases (some functions of the joyticks are not working or sound card does not even work correctly when certain joyticks are used !). Here is the joystick port pinout used in PC soundcards (Soundblaster, Gravis Ultrasound and many other):
PIN
PURPOSE
1
potentiometer common (Joy A)
2
button 1 (Joy A)
3
X coordinate potentiometer (Joy A)
4
button common (Joy A)
5
button common (Joy B)
6
Y coordinate potentiometer (Joy A)
7
button 2 (Joy A)
8
unused
9
potentiometer common (Joy B)
10
button 1 (Joy B)
11
X coordinate potentiometer (Joy B)
12
MIDI TXD (transmit) (computer -> midi)
13
Y coordinate potentiometer (Joy B)
14
button 2 (Joy B)
15
MIDI RXD (midi -> computer)

NEXT

 

Free Software
Delphi

Lesson 1
Delphi Programming
1.1. IDE Delphi
1.2. Component


Lesson 2
Printer Port
/ LPT
1.1.Basic
1.2.Address
1.3.Port Register
1.4.8 Bit Data Input
1.5.Test Circuitry
1.6.Assignment

Lesson 3
Printer Port / LPT
Experiments

3.1.LED
3.2.Swicht
3.3.Motor Stepper
3.4.DAC
3.5.ADC
3.6.Graph Display

Lesson 4
Serial Port

4.1.Basic
4.2.Hardware
4.3.Port Register

Lesson 5
Serial Port Experiments

5.1.LED
5.2.Stepper Motor
5.3.Swicht
5.4.ADC

Lesson 6
Game Port
Joy Stick
6.1. Basic
6.2. Experiments