Reading pot and button.
potatohead
Posts: 10,261
I've got a old VCS game controller I want to read.
There is one switch, and one pot, which is 1 mega ohm.
I'm confused about a few basic things:
1. Can I simply connect the button to a pin, through a 1K resistor, and the other side of the button to VSS on the demoboard? (assuming the pin is input)
Is there any real worry about where that resistor is? Can I just mount it inside the game controller, for the purpose of getting a quick and dirty setup for programming?
2. How to determine a good cap, and protection resistor for the pot?
Found the attached circuit on a forum search here. Can the right cap be installed inside the game controller as well, assuming the 1 state circuit shown?
pot.bmp
Secondly, I need a sample time of somewhere around 1/120 sec, with about 8 bits precision. Honestly, this can vary some.
Is this just C = time / resistance to approximate charge, discharge times?
There is one switch, and one pot, which is 1 mega ohm.
I'm confused about a few basic things:
1. Can I simply connect the button to a pin, through a 1K resistor, and the other side of the button to VSS on the demoboard? (assuming the pin is input)
Is there any real worry about where that resistor is? Can I just mount it inside the game controller, for the purpose of getting a quick and dirty setup for programming?
2. How to determine a good cap, and protection resistor for the pot?
Found the attached circuit on a forum search here. Can the right cap be installed inside the game controller as well, assuming the 1 state circuit shown?
pot.bmp
Secondly, I need a sample time of somewhere around 1/120 sec, with about 8 bits precision. Honestly, this can vary some.
Is this just C = time / resistance to approximate charge, discharge times?
Comments
I did battle on this last weekend, and just didn't have a lot of joy. If somebody could straighten me out on this stuff, I would appreciate it. I think I've got the code part down, just am not sure about the hardware part.
I want to use the set pin state, count until pin state changes method on the Pot, BTW. Not using the PWM method, which I understand requires components in close proximity to the Prop. Perhaps the other method does too, thus the question.
If there is something I need to add, let me know. (I'll take a RTFM with pointer too, no worries)
Kind of wanting to take another stab at this over the coming weekend, combined with the fun VGA / TV / Sprite driver we've recently built!
That might be a bit tricky as the example circuit is 10k. All the maths will be wrong.
re C = time / resistance to approximate charge, discharge times? Capacitor charge and discharge times are non linear http://upload.wikimedia.org/wikipedia/commons/thumb/f/f7/Capacitor_Square_wave_charge-discharge.svg/800px-Capacitor_Square_wave_charge-discharge.svg.png
(at least, that is true for a constant voltage and a fixed resistor. The curve is linear if you charge with a constant current).
I've not quite got my head around how the propeller reads voltages. Maybe you could use an op amp buffer as 1 meg is a fairly high impedance. Is it possible to open the controller and change the 1 meg to a 10k pot - then you could use all the standard circuits?
The button will be easy though and it would not matter where the resistor is.
Yeah, the maths will be wrong, which is why it all kind of died?
Can I scale a 1 meg ohm pot with a resistor in parallel, or something?
(somebody is gonna say, just try it, and I will barring some input here)
RTFM (Read The 'Fine' Manual)
Look at the Propeller Education Labs Fundamentals v1.1 ... http://www.parallax.com/Portals/0/Downloads/docs/prod/prop/PELabsFunBook-v1.1.pdf
In particular look at 'Measuring RC Decay' for reading your POTS, and 'Reading an Input' for the Switches
'Can I scale a 1 meg ohm pot with a resistor in parallel, or something?' - You 'can' , but it won't have a linear response ... depending on the application the non-linearity could be desired.
I had forgotten that was in there. One gets used to a certain mode of operating, and sort of ends up in "the bubble". That reference is just what I needed actually. Appreciated. At some point, early on, I had noted that for when this time came. Completely got side tracked, and didn't go down that path initially. As soon as I saw the chapter pages, I knew "been there before". Funny how that works.
--->"fine", yes. Exactly.