RE: Commodore joystick ports

From: Scott McDonnell (
Date: 2007-04-07 07:16:16


Wow, that is an old post. Looking back at it, I am not 100% sure of the
reason I suggested the transistor instead of just inserting the 0-5V
source, since the potentiometer is just being used as a voltage divider.

The only purpose that seems obvious to me right now was that I was
probably aiming at protecting the control port by isolating the control
circuit from the commodore. If the grounds between the two devices where
to get disconnected, the voltage could become unpredictable and possibly
create a damaging voltage situation. Ground is not 0V, but is a
reference, +5V just means 5V above ground in the circuit.

Using the transistor would allow you to use the 5V and ground from the
control port, in effect (at least partially) isolating the two circuits.

I see talk about "current source" there, which implies to me that I was
trying to explain the way the SID ADC works. the time of writing that, I seem to recall that I was studying
the internal circuitry of the SID. I will have to look into this again
and get back to you, it has been a while.

The question is, was I just using a sledgehammer to pound in a nail?

Scott McDonnell

-----Original Message-----
From: []
On Behalf Of Daniel O'Shea
Sent: Friday, April 06, 2007 10:26 PM
Subject: Re: Commodore joystick ports

...replying to quite an old message here, but it has given me an answer 
I've been looking for and I'm hoping that someone will be able to 
elaborate a little! I have a variable voltage of 0 to 5V, and I want to 
translate this in to a current to simulate the variable resistance of a 
potentiometer connected to the SID's ADC - Scott suggests using a 
transistor, but I want to know what kind of transistor and what value 
would work best to provide a variable current which duplicates the 
potentiometer's variable current? and do I need any extra components 
besides just a transistor? thanks!

> ----- Original Message -----
> Re: Commodore joystick ports
> From: Scott McDonnell (
> Date: 2004-10-22 20:44:06 
> Jim,
> As Hársfalvi mentioned, it is current that needs to be generated, not 
> voltage. A resistor creates a voltage drop across it, which is a 
> function of current. (Resistance=Current/Voltage) The voltage is 5V, 
> the resitance is a range that you know from the potentiometer values, 
> you simply need to create the corresponding current to emulate the 
> resistance you need.
> A transistor in this mode (current source) should be thought of as a 
> valve. The valve is completely shut off when no voltage is applied to 
> the base. This allows the SID to discharge the capacitor (when it is 
> shorting for 256
> cycles) without drawing in the 5V. By varying the voltage to the base,
> are opening the valve by a varying degree, varying the amount of
> which is allowed to flow.
> You are correct in assuming that you will need an analog voltage at 
> the base (but not to bias it, that is for amplication - to carry an AC

> signal through the transistor - you are simply using it like a valve.)

> If your micro does not have a DAC built in, you can build an R-2R 
> ladder DAC, like the one showing here: 
> or a Summing DAC 
> like here: 
> (without the op-amp). Obviously, the values of the resistors in the 
> circuit may need to be altered a bit to get the range of voltages you 
> desire. This will be based on some calculations, which are not 
> extremely difficult. Here's a page you can use for reference: 
> it 
> describes and explains how a transistor is used to convert voltage to 
> current. If you need some more help, drop me a line. I would be 
> willing to design the circuit for you when I have a spare moment, but 
> the true satisfaction comes from figuring it out yourself, so I won't 
> deprive you of that!
> A FET might actually do a better job, but the calculations get a bit 
> more complex, the cost increases, and is probably not necessary for 
> the type of resolution you will need. An 8-bit R-2R ladder DAC would 
> give you 256 voltage values to feed into the base of your transistor, 
> which would result in 256 different currents at each axis input. 
> Probably way more resolution than a commodore mouse provides.
> Scott McDonnell

       Message was sent through the cbm-hackers mailing list

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.