3

I have made up a DB9 connector with connections to an Arduino. I am using pins 1 to 4 on the connector. On the Arduino I have a small program which writes out a series of digital HIGH signals to the connector's pins. On the Commodore 64 I have a simple Basic program that reads the state of joystick port #1. The problem is that the Commodore 64 is not registering a state change on the port, it continually prints out a value of 255. I know the port works because I connected a joystick to it and tested it.

What am I doing wrong? Do I need to boost the current from the Arduino to the joystick port with a MOSFET, or a relay? Are the pins on the joystick port active HIGH, or active LOW.

5
  • 1
    This exact same question is cross-posted to ee.se. – Justme Mar 4 at 7:35
  • @Justme how lovely :( – Raffzahn Mar 4 at 12:06
  • as mentioned did you interconnected the GND? active is most likely LOW and did you configure ARDUINO to output direction of the pins? how long the LOW signal stays LOW? try at least 500ms for starters to be sure it is not speed issue. Did you measure the output voltage (if it alternates between high/low) and not in the forbidden range of TTL due resistors in the way? – Spektre Mar 4 at 12:09
  • 1
    Please show your circuit! – the busybee Mar 4 at 15:01
  • Here is Mario Gianota's similar question on Electrical Engineering Stack Exchange: electronics.stackexchange.com/q/551173 – Bavi_H Mar 4 at 23:30
12

TL;DR

  • The C64 expects a low value at input.

  • To make it work a common ground (pin 8) is needed.


A first starting point for such a project might be looking at the wiring of a joystick:

enter image description here

It shows that a C64 Joystick works by connecting either port pin to to ground. If that connection is not made, then all input will read high value - as you already found out. This is due the fact that the 6526 already contains internal pull up resistors, making sure that non grounded pins will deliver a steady high signal.

Essentially this means outputting a LOW from the Arduino would make the value for that button (pin) go zero. Except, to do so, they need to agree what low means, as each device low is independent - unless they use a common ground, like with connecting the ports pin 8 (GND) to whatever it is on the Arduino side.

Last, but not least it might be a good idea to see the Arduino's AVR doesn't drain more current than the 6526 sources, but I guess it should work, as there are serial resistors within the C64, limiting the current. To see such, it helps to peek at the C64's schematics (http://www.zimmers.net/ is always a good stop for all things Commodore).

3
  • 1
    Okay I have done all that and it is still not working. Do you have any other ideas as to what the problem might be, because I am stumped. – Mario Gianota Mar 4 at 3:24
  • 5
    @MarioGianota Well, next step would be to present your full setup (eventually including a schematic) in your question. So far it's a rather vague description, isn't it? Also, do you give static signals or pules? keep in mind, the Arduino is a tiny bit faster than the C64 - abuer 20 to 50 times. [P.S.: You're aware that your question is rather borderline here as the problem might be on the Arduino side? ] – Raffzahn Mar 4 at 3:45
  • Sourcing inputs are one of the big things that novices get wrong. This idea that voltage needs to go into an input is difficult to break. Even in industrial settings I've seen ridiculously elaborate schemes used to force a sourcing output onto a sourcing input... all that headache when all they needed to do was connect a switch. This is an important lesson, and one that many have to learn the hard way. +1 Personally, I would stick the Arduino's outputs onto the base of a set of transistors and use those to pull the joypad inputs low. – J... Mar 4 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.