SID chip ADC question [message #101318] |
Wed, 02 February 2005 21:23 |
David Murray
Messages: 1017 Registered: January 2005
Karma: 0
|
Senior Member |
|
|
You guys seem to know all the websites to look at, even though I spend
hours searching on google and yahoo and never find them.
I'm trying to find more specific information on the SID chips analog-to-
digital converters. I know the basics and how to use it. But I am
interested in using it for a variety of things. First of all, sensing
temperature. Should be pretty straight forward hooking a thermistor up
to it and simply calculating or maybe experimenting to find out what
values equal what temperature. In fact, I took some thermistors off some
old Dell computer fans today but haven't yet connected them up.
The other thing I need to do is read voltage.. Yeah, sort of like a volt-
meter. Now, here is the part I'm unsure of. Does the SID chip actually
read resistance or voltage? One article I read suggested that it reads
from zero to 10 volts. But I'm a little afraid to just pump straight
voltage into the SID chip.. something doesn't seem right about that. But
even if that is the case, I need to read between a range of about 5V and
20V so I'd need to setup some kind of transistor and honestly at the
moment I'm a little weak on analog electronics.. Okay, I'm a lot weak on
that subject. But I am sure somebody has done these things before and
I'm curious to see what has already been tried.
oh.. does the Vic-20 have an ADC? I think it does, but is it integrated
to the VIC chip or is it on a seperate chip? I am told the Plus/4 has no
ADC, is that correct?
any help or websites appriciated!
email me at adric22 at yahoo dot com
--DavidM
|
|
|
Re: SID chip ADC question [message #101324 is a reply to message #101318] |
Wed, 02 February 2005 23:25 |
Jim Brain
Messages: 962 Registered: August 2012
Karma: 0
|
Senior Member |
|
|
David Murray wrote:
> I'm trying to find more specific information on the SID chips analog-to-
> digital converters. I know the basics and how to use it. But I am
> interested in using it for a variety of things. First of all, sensing
> temperature. Should be pretty straight forward hooking a thermistor up
> to it and simply calculating or maybe experimenting to find out what
> values equal what temperature. In fact, I took some thermistors off some
> old Dell computer fans today but haven't yet connected them up.
From :http://stud1.tuwien.ac.at/~e9426444/sidtech3.html
These pins are inputs to the A/D converters used to digitize the
position of potentiometers. The conversion process is based on the time
constant of a capacitor tied from the POT pin to ground, charged by a
potentiometer tied from the POT pin to +5 volts. The component values
are determined by:
R*C = 4.7E-4
Where R is the maximum resistance of the pot and C is the capacitor. The
larger the capacitor, the smaller the POT value jitter. The recommended
values for R and C are 470 kOhm and 1000 pF. Note that a separate pot
and cap are required for each POT pin.
The best note, tho, is from:
http://www.softwolves.pp.se/misc/arkiv/cbm-hackers/9/9820.ht ml
Yes, that's me he's replying to. I had to figure out the POT lines to
build a PSX->Atari joystick converter
> The other thing I need to do is read voltage.. Yeah, sort of like a volt-
> meter. Now, here is the part I'm unsure of. Does the SID chip actually
> read resistance or voltage? One article I read suggested that it reads
Resistance/current.
> from zero to 10 volts. But I'm a little afraid to just pump straight
Well, it's the current, so I guess you could go > 10, but the caps are
rated to 16v, so I would not go above that. In fact, I'd be leery of
anything above 5.
> oh.. does the Vic-20 have an ADC? I think it does, but is it integrated
> to the VIC chip or is it on a seperate chip? I am told the Plus/4 has no
> ADC, is that correct?
I know the VIC does, and I assumed the 264 series did, as it's used for
the paddles.
The Google search was:
http://www.google.com/search?sourceid=navclient&ie=UTF-8 &rls=GGLD,GGLD:2004-36,GGLD:en&q=SID+POT+lines+volta ge+or+current
:-)
Jim, it's not the tool, it's how you use it, Brain
--
Jim Brain, Brain Innovations
brain@jbrain.com http://www.jbrain.com
Dabbling in WWW, Embedded Systems, Old CBM computers, and Good Times!
|
|
|
Re: SID chip ADC question [message #101338 is a reply to message #101324] |
Thu, 03 February 2005 09:48 |
David Murray
Messages: 1017 Registered: January 2005
Karma: 0
|
Senior Member |
|
|
Okay.. so according to the equation if I wanted to increase the range I
could read a thermistor that didn't reach 470K ohms resistance, but say
it could reach 250K ohms.. then I could change out the capacitors on the
motherboard to 500 pF caps instead?
The one thing I'm confused about.. I'm looking at the schematic of the
C64. I see the POT wires come in which would presumably be carrying 5
volts (minus whatever resistance) and they don't pass through a cap they
go straight to the POT lines on the SID. Now the caps are tied from
ground to the same wire that goes into the SID. So how does the SID
measure the discharge time since the current is never stopped comming
from the external POT lines. Or does the SID have to somehow measure
both the incomming current along with whatever charged in the CAP? THat
being the case, I wouldn't want to send anything over 5V to the SID. The
main thing I wanted to measure would have been the voltage on a 12V
battery. That can be as high as 14 volts on a good charge. I figured a
range from 5 to 20 would be good for that, but it doesn't have to be. I
guess I need to disassemble a multi-meter and see how they do it.
--DavidM
> These pins are inputs to the A/D converters used to digitize the
> position of potentiometers. The conversion process is based on the
> time constant of a capacitor tied from the POT pin to ground, charged
> by a potentiometer tied from the POT pin to +5 volts. The component
> values are determined by:
>
> R*C = 4.7E-4
>
> Where R is the maximum resistance of the pot and C is the capacitor.
> The larger the capacitor, the smaller the POT value jitter. The
> recommended values for R and C are 470 kOhm and 1000 pF. Note that a
> separate pot and cap are required for each POT pin.
|
|
|
Re: SID chip ADC question [message #101356 is a reply to message #101338] |
Thu, 03 February 2005 10:52 |
Dancin' Pete
Messages: 42 Registered: July 2003
Karma: 0
|
Member |
|
|
"David Murray" <spamsucks@stopspam.com> wrote in message
news:Xns95F25A0BC106Cneverspamnospamcom@151.164.30.42...
> Okay.. so according to the equation if I wanted to increase the range I
> could read a thermistor that didn't reach 470K ohms resistance, but say
> it could reach 250K ohms.. then I could change out the capacitors on the
> motherboard to 500 pF caps instead?
I would put two in serial very close to each other.
>
> The one thing I'm confused about.. I'm looking at the schematic of the
> C64. I see the POT wires come in which would presumably be carrying 5
> volts (minus whatever resistance) and they don't pass through a cap they
Check your schematics again, note the 5v output on the joystick port (its
not just for rapid fire).
5v, through your resistance element, to charge the capacitor.
My understanding.
From discharged, the SID will monitor the POT lines for 256 clock cycles,
noting how many cycles it took for the capacitor to charge (ie, near enough
to 5v).
The SID discharges the capacitor internally to ground. 64 clock cycles are
allocated for this.
Repeat. (256+64 cycles)
It is all a matter of timing, not voltage.
|
|
|
Re: SID chip ADC question [message #101362 is a reply to message #101338] |
Thu, 03 February 2005 12:54 |
Jim Brain
Messages: 962 Registered: August 2012
Karma: 0
|
Senior Member |
|
|
== Quote from David Murray (spamsucks@stopspam.com)'s article
> Okay.. so according to the equation if I wanted to increase the
range I
> could read a thermistor that didn't reach 470K ohms resistance,
but say
> it could reach 250K ohms.. then I could change out the
capacitors on the
> motherboard to 500 pF caps instead?
Yep.
> The one thing I'm confused about.. I'm looking at the schematic
of the
> C64. I see the POT wires come in which would presumably be
carrying 5
> volts (minus whatever resistance) and they don't pass through a
cap they
> go straight to the POT lines on the SID. Now the caps are tied
from
> ground to the same wire that goes into the SID. So how does the
SID
> measure the discharge time since the current is never stopped
comming
> from the external POT lines. Or does the SID have to somehow
I believe it watches the amount of time it takes for the cap to
reach a certain voltage threshold.
|
|
|
Re: SID chip ADC question [message #101363 is a reply to message #101356] |
Thu, 03 February 2005 13:05 |
Jim Brain
Messages: 962 Registered: August 2012
Karma: 0
|
Senior Member |
|
|
> My understanding.
> From discharged, the SID will monitor the POT lines for 256
clock cycles,
> noting how many cycles it took for the capacitor to charge (ie,
near enough
> to 5v).
> The SID discharges the capacitor internally to ground. 64 clock
cycles are
> allocated for this.
> Repeat. (256+64 cycles)
Correct, though it's 256 watch, 256 ground.
And, as I found while creating PSXJoy, you can simulate a paddle
by delivering 256 "bursts" of 5v to the POT line, as the 1351
mouse does. That "hack" amazes me.
Essentially, you watch the POT line from the 64 until you see it
go low. You wait for 256 1MHz cycles (discharge cycle). Then,
say you want the POT register to read 100. You wait 256-100
cycles, then jam the POT line high through a small (2.2K)
resistor. Continue to watch for the line to go low. When it
does, turn your 5volt output off, and repeat the process.
I was amazed it worked. I credit Levente and others with
explaining the idea. My implementation took it a bit further, as
I count the number of cycles between successive ground triggers.
If my counter > 512, I dynamically slow down the CPU clock, if <
512, I speed it up. In this way, I sync to the 64 clock, and can
thus give perfect readings on PAL or NTSC and deal with frequency
drift.
Jim
|
|
|
|
Re: SID chip ADC question [message #101723 is a reply to message #101338] |
Sun, 06 February 2005 13:13 |
Jim Brain
Messages: 962 Registered: August 2012
Karma: 0
|
Senior Member |
|
|
David Murray wrote:
> Okay.. so according to the equation if I wanted to increase the range I
> could read a thermistor that didn't reach 470K ohms resistance, but say
> it could reach 250K ohms.. then I could change out the capacitors on the
> motherboard to 500 pF caps instead?
>> R*C = 4.7E-4
As someone pointed out to me, you actually need to double the cap if you
halve the resistance. So 500pF would be incorrect, 2000pF (2nF) would be
correct.
Jim
--
Jim Brain, Brain Innovations
brain@jbrain.com http://www.jbrain.com
Dabbling in WWW, Embedded Systems, Old CBM computers, and Good Times!
|
|
|
Re: SID chip ADC question [message #101726 is a reply to message #101362] |
Sun, 06 February 2005 14:07 |
Jim Brain
Messages: 962 Registered: August 2012
Karma: 0
|
Senior Member |
|
|
Jim Brain wrote:
> == Quote from David Murray (spamsucks@stopspam.com)'s article
>
>> Okay.. so according to the equation if I wanted to increase the
>
> range I
>
>> could read a thermistor that didn't reach 470K ohms resistance,
>
> but say
>
>> it could reach 250K ohms.. then I could change out the
>
> capacitors on the
>
>> motherboard to 500 pF caps instead?
>
>
> Yep.
As noted in another response, if you halve the resistance, you need to
double the capacitance, not halve it.
--
Jim Brain, Brain Innovations
brain@jbrain.com http://www.jbrain.com
Dabbling in WWW, Embedded Systems, Old CBM computers, and Good Times!
|
|
|