problem reading capacitor in RC circuit
ispear
Posts: 20
Hello,
I am working with a 2-axis joystick that uses two 10K pots. I have a .01uF capacitor spanning the leads of each pot and wires going from ground to the pot and then the pot to the propeller's I/O pins respectively. My program works and displays a value for the position of the pot but I only have half of the pot's range. When I turn the pot past half way the value seems to max out and will not deliver a value. So, I get feedback from the UP and RIGHT motions of the joystick but I do not get anything for the LEFT and DOWN motions. I have tried many different 10K pots. Any Ideas???
Many thanks,
-Isaac
I am working with a 2-axis joystick that uses two 10K pots. I have a .01uF capacitor spanning the leads of each pot and wires going from ground to the pot and then the pot to the propeller's I/O pins respectively. My program works and displays a value for the position of the pot but I only have half of the pot's range. When I turn the pot past half way the value seems to max out and will not deliver a value. So, I get feedback from the UP and RIGHT motions of the joystick but I do not get anything for the LEFT and DOWN motions. I have tried many different 10K pots. Any Ideas???
Many thanks,
-Isaac
Comments
Your description is pretty vague. Please post a schematic, along with your source code.
-Phil
You could also have a look at sigma delta ADC available as application note somewhere on parallax.
Thanks, Isaactestpot_2a.spin
Do you have some specs of the joystick? Maybe the 2 resistor connectors of both axles are connected internally.
You set the pins high to load the capacitor and you wait for a while until it's loaded.
Then you set the pins to input so that the capacitor is unloaded via the poti. The counter counts as long as it sees HIGH signal. But you immediately read PHSx which means that you only give the counter the time that SPIN needs between setting the pin to input and the read PHSx instruction. You should simply add a little waitcnt between DIRA[x]~ and TIMEx:=PHSx.
-Phil
You mean like this?
What kind of response / range / timing will this provide?
I was just wonderin.. you are using a LINEAR pot?
Because if its a LOG pot, setting it halfway does not give the expected half value...
on second thoughts if it is an industry joystick then the pots will be linear
Dave