Interfacing pic to joystick port

Discussion in 'Embedded Systems and Microcontrollers' started by Art, Mar 23, 2015.

  1. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    Hi Guys,
    I want to interface a pic port to a retro computer or arcade machine board of the variety that
    expect microswitches to ground the appropriate input pins with action on the connected joystick.
    The computers are Amiga, Atari, early Sega, etc, that all use joysticks with female D9 connector.

    Since the retro computer’s joystick port pins are probably tied high with resistors already,
    I expect it would be possible to just connect directly to the pic and sink the pins,
    but this would typically be buffered in some way would it not?

    Perhaps transistors such as BC549, or just use a digital logic IC as a buffer?
    Any advice would be appreciated.
    Cheers, Art.
     
  2. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,521
    2,369
    Could be opto isolated inputs?
    In any event a 2n7000 would most likely work.
    Max.
     
  3. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    Thanks Max, I’m sure I can try one on it’s own just on a fire button or something,
    but part of the question is for my education, not just getting the project to work.

    The boards always look to be 5 Volt, and so is the micro, but still in this situation
    I would expect an external IO interface to be buffered with something so the micro isn’t directly connected to the external port.
    It’s an overall design question.

    If the voltage of both circuits is the same, is it just to protect the micro in the circuit from unexpected current?
    Also why would you choose a FET rather than a signal transistor or some other method?
     
  4. MCU88

    Member

    Mar 12, 2015
    360
    35
    Been there done that. No need for an buffer. A buffer is really only required in circuits to get around the 'loading effect' -- of other parts hanging off the circuit. Connect straight to the MCU's port configured as inputs. Throw on some 100K pull-up resistors for good measure.
     
    ErnieM likes this.
  5. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    I don’t doubt it would just work, but is it proper?
    One concern is AFAIK the pic isn’t completely protected from CMOS latchup,
    so it would seem at least diode clamps on the pins would at least be the way to go if there was no hardware buffer.

    The reason I’m so pedantic is it’s a hand wired, hand soldered protoboard with 11 chips so far,
    and none are socketed or easily removable, so I’m interested in it’s long term service.
     
  6. MCU88

    Member

    Mar 12, 2015
    360
    35
    The PIC incorporates some of the BEST I/O architecture ever accomplished.
     
  7. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Diode clamps on the outputs just put a secons diode in parallel with the existing ESD diodes inside the chip output pins.

    If you add an intermediate buffer you have the same (non) issue with that devices output connected to the pull ups. It changes nothing.

    The sole consequence I would forsee is the micro running off the power it would get from the pull up, but that also has to power your entire circuit too.

    Just connect the micro output directly and sleep soundly.
     
  8. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    Ok I suppose two votes is enough, thanks :D
    I don’t know whether to call them inputs or outputs.
     
  9. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    Ok, I just got the EEPROM running tonight, It’s an 8 device I2C bus,
    and then some more that are powered and enabled, but not yet used.

    at 0.1 second resolution It (currently provides over 7 hours,
    so I think I can afford a much higher capture rate.
    Note there’s no output to any computer’s joystick port yet ;)

     
  10. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    I didn’t listen at all :D I think I liked the idea of the pic port appearing as output when using the transistors.
    Should I have used any current limiting resistors on the signals from the computer board?

    [​IMG]

    and done :)
     
    RRITESH KAKKAR likes this.
Loading...