Back in the day a very common trick to measure pots was with a VR method. I'm trying to accomplish this without a 555 timer using just a micro controller and cap. I'm thinking this may not work well because each lead (the out and the in) will be balanced at some point but I have had some success so far. Currently, what is getting in the way, is when I measure more then one pot. Pot 1 is fighting with 3? The Gameport pinout shows that x and y share the same +5 as do x2 and y2. In my design all for pots share the same power lead and I not sure but possibly I need to use at-lease two separate leads for that.
VR 1-100k ohms
volts (powered from mcu)
a pc game port controller. (lots of schematics on line for this). It is just a 1-100k POT connected via two wires.
my time constant.
|Time constant||~120 microseconds|
|Rise time from 20% to 80%||168 microseconds|
|Rise time from 10% to 90%||~264 microseconds|
|3dB cutoff frequency||~1.326291 kilohertz|
PORTD 0x80 is the lead I'm measuring from and has the Cap on it.
PORTC's 0-3 are my pots.
My thought is begin by bring one of the PORTC lines hi, waiting 1ms or so and then bring it low, then loop and discharge through the resister until PORTD 0x08 reads lo and return the value.
code example that does work but has the issue I mentioned above. If I disconnect all pots but one of them, that pot read a perfect value.
unsigned char getvalue (POT)
unsigned char i=0;
DDRC = POT;//keep this line out at all times.
PORTC = 0;//bring the line lo ( and all other as they seem to be interfering).
for (;i<254;i++)// now start the count (127us max)
if (!(PIND & 0x08 )) break;
PORTC = POT;//bring only the target pot lead hi
PORTD &= ~0x08;DDRD &= ~0x08;// set for read (I must hold this line lo or I get a strange result, I can explain if needed).