From: Scott McDonnell (NetSamurai_at_comcast.net)
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, you are opening the valve by a varying degree, varying the amount of current 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: http://www.hut.fi/Misc/Electronics/circuits/r2r.html or a Summing DAC like here: http://www.phys.ualberta.ca/~gingrich/phys395/notes/node162.html (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: http://www.williamson-labs.com/480_xtor.htm#voltage-current 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 ----- Original Message ----- From: "Jim Brain" <email@example.com> To: <firstname.lastname@example.org> Sent: Thursday, October 21, 2004 5:06 PM Subject: Re: Commodore joystick ports > > more, it appears that it bangs the 6 bit position data digitally (why it > > would do this on the POT port, I don't understand...) Is this what you > > getting from this?: > > http://www.funet.fi/pub/cbm/documents/projects/interfaces/mouse/Mouse.html > > Yes. It does that to "feed" 1uS chunks of 5V to the capacitor used by SID > to determine the pot position (using the idea that you can detect voltage > by charging a cap to that voltage and measuring how long it takes to > discharge.) The more 1uS chunks of 5V I feed, the more charge the cap > has, the higher voltage is recorded. Primitive, but I was amazed that it > works pretty well. > > > I would think it would make more sense to simply emulate a paddle. In > > which > > case, you could use a transistor to create a current source on each pot > > port > > which would emulate a paddle. It is a little early for me this morning to > > think clearly, but I will look at this later tonight and try to help more > > if > > someone doesn't already answer you. > > Because I loathed this bit-bang the POT line approach, I tried a bunch of > other ideas first. > > My initial idea was to use PWM through a low pass RC filter to create the > correct voltage, but that did not work at all. I'm still not sure why > this simplistic approach did not work. > > I then thought of using a digital pot, but it looks like the POT lines > need a 500k pot swing to go from 0 to 255, and I couldn't find a part that > swung that far. > > I then looked at serial DACs, as Maxim has some low cost dual SPI DAC > parts, but Could not determine if that would work, so abandoned the idea. > > I did not try a current approach (Analog is my weak subject), but wouldn't > I need some sort of analog input to the transistor in order to bias it to > a certain level? > > Jim > > 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.