# Re: Commodore joystick ports

From: Hársfalvi Levente (hlpublic_at_freestart.hu)
Date: 2007-04-09 10:50:00

```Hi!,

It was very long ago when I last experimented with this ADC, and it was
pretty hard to understand how this could be done back then. (In fact, I
couldn't make it, but discovered how the original 1351 mouse worked
instead). But now, hmmm... I think I have an idea that might be useful here.

It's clear that there's no use to connect a voltage signal directly to
the ADC input... it won't work. So?

The first possible solution (or better said, workaround) could be to
divide the signal by 2 and add an offset of Vcc/2 (2.5v). This could be
done by an amplifier (ua741, TL081 and the like... you might want to
find a rail-to-rail type one, though, as those standard amps need
symmetric voltage supply (say, +-10v) to operate well). Apply a series
resistor, and connect the signal to the ADC. This would work (but
whether it would be linear, I mean: the series of the captured numbers
as a function of the original signal, I won't make a bet).

Second, you could use a pnp transistor as a "valve".

o Vcc
| E
|
R   B   /
|<
Vin -> o-|##|----|
|\
\
| C    Rs
o-----|##|---o  --> POTX

I won't say that it's linear, either... the transistor won't open until
Vcc-Vin>0.6v, and this setup also inverts phase. From the other hand,
here the "open"-ness of the "valve" is a function of Vcc - Vin, and not
Vin-Vpotx that the npn approach would look like. ...So, this is possibly
something that is worth experimenting with, but not "the" solution.

There should exist a simpler and better path. If you find a simple,
standard example of a voltage-to-current converter schematic (I don't
mean a complicated one, but something presumably built up by an
amplifier and some resistors) and you can implement it by a rail-to-rail
amplifier IC, you're probably on your way.

Still, it should be easier to take the digital approach, especially if
the original form of your "0...5v signal" is digital. Todays cheap
microcontrollers (Atmel AVRs especially) are fast and flexible enough to
create a precise converter (linear response, no jitter), provided that
you're goot at their assembly language.

Greets!,

Levente

Daniel O'Shea wrote:
> ...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!

Message was sent through the cbm-hackers mailing list
```

Archive generated by hypermail pre-2.1.8.