Shop OBEX P1 Docs P2 Docs Learn Events
Interfacting Basic Stamp with Gameport/Joystick — Parallax Forums

Interfacting Basic Stamp with Gameport/Joystick

DiablodeMorteDiablodeMorte Posts: 238
edited 2008-02-18 06:36 in BASIC Stamp
Hiya everybody,

The subject line tells all: I'm trying to interface a gameport/joystick with a basic stamp. Before even looking up Gameports I got my Basic stamp reading a pot since I figured that what a joystick uses. After trying a similar approach with the gameport it seems I was mistaken. I took my joystick apart and it seems to not be controlled by pots in the normal sense. There are only 2 wires going to each "axis" which are mostly slides which I assume change resistance as the joystick is used/manipulated. How do I use this caputure this data? In the case of the throttle pot(which still only has 2 wires going to it) can I simply wire up the third post and use it as a normal pot?

Regards,

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Current Projects:
Robot Control Via Skype API - Dev Stage(50% Complete) - Total(25%)
Robot Localization Via Xbee's - Research Stage
IR Tracking with Propeller - Research Stage

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-02-17 08:05
    DiablodeMorte -

    You may find this gameport pinout of assistance in decoding and understanding the signals at the PC gameport connector:
    http://www.technick.net/public/code/cp_dpage.php?aiocp_dp=pinconjoy_pc_game

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Genius is one percent inspiration and ninety-nine percent perspiration."

    Thomas Alva Edison

    Post Edited (Bruce Bates) : 2/17/2008 8:57:04 AM GMT
  • DiablodeMorteDiablodeMorte Posts: 238
    edited 2008-02-17 14:40
    @Bates:

    My problem isn't so much the actual wiring of the gameport, I simply don't have enough eletronics knowledge to know how to hook the gameport for reading by the basic stamp. I know I apply +5v to the +5v rails but with the examples in the stamp manual, all the Potentiometers had three rails(Pwr, Data, and Ground) and a gameport seems to only have two(Pwr and data). I just need to know how to get RCTIME to tell me the pot value of the axises.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Current Projects:
    Robot Control Via Skype API - Dev Stage(50% Complete) - Total(25%)
    Robot Localization Via Xbee's - Research Stage
    IR Tracking with Propeller - Research Stage
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-02-17 16:24
    Joysticks come in two varieties: cheapo and expensive.

    The expensive ones have pots on the X and Y axis. Sometimes they have two on each axis·for a total of 4, but you really only need to use two.· I suppose the other two are backups for military and industrial·hardware.·I've seen beautiful ones for $125 USD.

    The cheapo are just four switches triggered by a stick. Not only is this mechanically much cheaper, it is easier for a microprocessor to manage in the code. The drawback is that it would usually take at least four sense wires and a common [noparse][[/noparse]total of five wires] to hook up.

    Anton's Hydra uses an old game control with the cheapo version of a joystick. You really cannot sense the difference in play or feel. But it has a 'serializer' connected to the 4 switches and other buttons·to reduce the wire count to +5, Gnd, and serial output.· The microprocessor just reads a serial in format.

    You can buy from a Chicago/Las Vegas outfit, the cheapo versions in heavy duty arcade forms and they generally are all you ever need.· You can hook up the 4 switches directly.·There really isn't any need to 'serialize' unless you need the extra I/O.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PLEASE CONSIDER the following:

    Do you want a quickly operational black box solution or the knowledge included therein?······
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan

    Post Edited (Kramer) : 2/18/2008 6:34:01 AM GMT
  • FranklinFranklin Posts: 4,747
    edited 2008-02-17 18:22
    If you look at the document linked to you will see a diagram of the joystick and what's inside. The outputs from the joystick are voltages from +5v to a lower value (not stated) you feed it +5v and ground from the stamp ps and read the voltage on the joystick pins. The pots are open ended.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-02-18 06:36
    Regarding the cheaper alternative, I neglected to correctly explain the 'serializer'. It is usually a shift register and requires four wires - +5v, 0v, serial out, clock in. Your BasicStamp Manual has a good explanaton under the SERIN command section. Many of the game machines have more than 8 switches in their user interface, so they may use a 16 bit shiift register rather than the 8 bit one. You can put two 8 bit shift registers together to make a 16 bit one and still have only 4 wires to the BasicStamp.

    The newer USB gameport interface is really too complicated for a BasicStamp to handle without outside help from a chip that converts the USB to serial.· So, I would stay away from that sort of interface if you are just starting out.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PLEASE CONSIDER the following:

    Do you want a quickly operational black box solution or the knowledge included therein?······
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
Sign In or Register to comment.