/FAQServer от 2:5025/38.12@fidonet/Подборка по компьютерной тематике/Разьемы/Много чего про игровой порт

Тема:     gameport
----------------------------------------------------------------------------
 AK> Хотелось бы сделать датчик темпеpатуpы на основе теpмоpезистоpов и
 AK> субжа. Собственно вопpос к каким контактам подключать pезюки, и как
 AK> потом считать данные из этого поpта.
 15-pin D-shell connector:

 PIN SIGNAL  PIN SIGNAL
 --- ------  --- ------
  1 +5V   8 +5V
  2 button 1  9 +5V
  3 stick 1  10 button 3
  4 GND  11 stick 3
  5 GND  12 GND
  6 stick 2  13 stick 4
  7 button 2 14 button 4
    15 +5V

 Game card has a female connector;
 Joystick cable has male connector.
 Joystick wiring:

  +5 ________________
                          |
  stick1 ________ |
    | 100K  |
       _/\/\/\_____|
  stick2 ________ |
    | 100K  |
       _/\/\/\_____|
  stick3 ________ |
    | 100K  |
       _/\/\/\_____|
  stick4 ________  |
    | 100K  |
       _/\/\/\_____|
         ___
  button1 ______o o_______
         ___       |
  button2 ______o o_______|
         ___       |
  button3 ______o o_______|
         ___       |
  button4 ______o o_______|
     |
  GND ________________|


> 2) As near as I can figure, I have to use the inpw() function (I'm using
>    C) to read the ports.  Unfortunately, I don't know the port number to
>    give the function to read the port.  If this isn't the right/best
> way,
>    please let me know.

 You need to do byte I/O to and from port 201h.
 To read the joysticks (or your slide pot positions), you
 must first write a byte to port 201h.  It doesn't matter
 what value you send, as long as you perform an I/O write.
 This triggers the 558 timer on the game adapter.

 Game port 201h byte:
  _______________________________________________________
 |   7  |   6  |   5  |   4  |   3  |   2  |   1  |   0  |
 | but4 | but3 | but2 | but1 | stk4 | stk3 | stk2 | stk1 |
 |______|______|______|______|______|______|______|______|

 The most machine-independent way to sample the game port
 is to use a timer.  Note the time (e.g., read the countdown
 register in Timer 0, you need pretty fine resolution and this
 timer performs 65535 counts every 55 ms) just before you
 trigger the 558.  After triggering, sit in a loop reading
 port 201h and examining bits 0-3.  For those bits that have
 a joystick pot attached, you'll see them sit for a while at 0,
 then become 1.  As each bit flips back to 1, note the time
 again.  When all bit 0-3 have flipped back to 1, you're almost
 done.  Compute elapsed time for each bit, and you end up with
 a value that is proportional to pot position.

 If you're lazy and don't care about machine independence,
 you can just trigger the card, then sit in a loop and count
 up from zero.  As each bit flips back to 1, save the count
 for that bit.  I've seen a few games that probably use
 this method.  Problem is that if you then run the same code
 on a faster/slower machine, your calibration can get very
 easily messed up.

 Buttons can be read at any time just by reading port 201h
 and looking at bits 4-7.  No triggering is required.
 Button bits are normally 1; while a button is depressed,
 its bit will flip to 0.

___________________________________________

- [0] SU.HARDW.SCHEMES (2:5025/35.3) ------------------------ SU.HARDW.SCHEMES -
 Msg  : 303 of 400                                                              
 From : Evgeny Sitnikov                     2:5055/61       23 Feb 97  09:42:28 
 To   : Andy Shevchenko                                     24 Feb 97  08:08:42 
 Subj : Внимание всем!                                                          
--------------------------------------------------------------------------------
Здравствуйте, Andy!

 Дело было Wednesday February 19 1997 21:04, и Andy Shevchenko писал Evgeny
Sitnikov:

 AC>>>> P.S. Я уже давно пользуюсь 5В, выведенными с клавиатуpы.
 DZ>>> Кстати, еще на джойстике, вроде, есть.
 >> 1     4 5     8          Вид с моpды.
 >> * * * * * * * *       4,5 - Gnd
 >>  * * * * * * *       15,8 - +5V
 >> 9           15

 AS> И еще 12 - GND.

12 - MIDI Out
 9 - MIDI In

 AS>                             С уважением  Andy Shevchenko :+)

С уважением, islander.

  Sometimes I feel like... Screaming close my eyes, It's times like this
  my head goes down and the only thing I know is the name of this town (dp)

... HardRock Group ISLAND Let's Rock!
--- R'n'R not dead, only many it not needed, but some can't live without it...
 * Origin: iSLAND Records Studio (Beer'em All) (2:5055/61)



File created by Faq2Site converter. (C) 1998-2002 Edward Grebenyukov
Hosted by uCoz