PC Gameport (Joystick) connector |
pinout (распиновка) |
15 pin D-SUB FEMALE connector at the computer | 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.
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. How PC joystick port hardware worksThe joystick port is a very simple 8 bit I/0 card which resides in ISA bus I/O address 201h. The CPU can read and write to the joystick port I/O address 201h. Writing to that address starts joystick postition measurement. Joystick interface only uses the signal that somebody is writing to the I/O address to reset the multivibrators in the card. The data value is not stored anywhere, so it is really same what value is written to this address. When you read one byte from I/O addess 201h, you get the status information of the joystick interface. The following table will show how the bits are mapped in the value you get. Game port 201h byte: _______________________________________________________ | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | | but4 | but3 | but2 | but1 | stk4 | stk3 | stk2 | stk1 | |______|______|______|______|______|______|______|______|The four most significant bits tell you the state of the joystick buttons. Four least significant bits tell the state of the multivibrators which are used for measuring the resistance value of the joytick position potentiometers. More accurate description of the bit meanings can be found at the table below: 7 6 5 4 3 2 1 0 * . . . . . . . Button B2 (pin 14), 0=closed, 1=open (default) . * . . . . . . Button B1 (pin 10), 0=closed, 1=open (default) . . * . . . . . Button A2 (pin 7), 0=closed, 1=open (default) . . . * . . . . Button A1 (pin 2), 0=closed, 1=open (default) . . . . * . . . Monostable BY (from pin 13), 1=timing, 0=timed-out . . . . . * . . Monostable BX (from pin 11), 1=timing, 0=timed-out . . . . . . * . Monostable AY (from pin 6), 1=timing, 0=timed-out . . . . . . . * Monostable AX (from pin 3), 1=timing, 0=timed-out Resistive analogue inputs (joystick position)
Joystick position inputs are simply inputs where a variable 0-100 kohm joystick
potentiometer is connected to. The potentiometers are wired between the +5V power
pin and one potentiometer input pin. The following picture tries show how
the wiring is done:
NOTE: Reference design in Crystal Semiconductor CD4376B calls recommends C1 to be 5.6 nF and R1 to be 2.2 kohm for their soundcard reference design. The multivibrator work on the following way:
This simple joystick port hardware implementation (originally designed for 4.7 MHz IBM PC) causes many headaches to game programmers (problems of different computer speeds, joycitck port differences, problems in multitasking operating systems etc.). Big tolerances in joysticks and joystick ports mean that the every game must have an option to cablibrate the joystick (which actually means that the program adapts to accept the values in th range which the joystick reading routine does and then converts the values to it"s internal format using the values measured in joystick calibration process).
Switch inputs (joytick buttons)
The joystick buttons are simple on/off inputs. Joystick button either leaves the
pin floating or connect it to the ground.
NOTE: Reference design in Crystal Semiconductor CD4376B calls for 4.7 kohm pullup resistor and 1000 pF capacitor from input to ground. When one button is pressed down, that input is grounded which caused the voltage on that pin goes to 0V which means that the joystick interface then gets logic 0 form that input. If you just keep reading the joystick port I/O address contantly, you will get a real-time sate of the button pins. Note: Direction is Computer relative Joystick.
| 15 pin D-SUB MALE connector at the joystick cable | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Pinouts.ru > Порты для устройств ввода (клавиатуры, мыши, джойстики) > Распиновка PC Gameport (Joystick) connector использующего разъем 15 pin D-SUB FEMALE и разъем 15 pin D-SUB MALE Источник(и): www.epanorama.net, from Hardware Book | Статус документа: | |
отметить как правильный |
0 отзыв(ов) | |
Щелкните по одной из ссылок для изменения статуса документа. |