![]() |
HELP: analog input
Hey,
I'm trying to get an analog input from my 10 Kohm but all i get is a series of numbers counting downwards and reseting the controller makes it go back from the number in which it stopped instead of the one in which it began... Any suggestions? |
Re: HELP: analog input
Quote:
Otherwise, the best we could offer up is a generic "look at Kevin's code" here: http://www.kevin.org/frc/ response. |
Re: HELP: analog input
printf("Pot %d\r", Get_ADC_Result(1));
|
Re: HELP: analog input
The counting occurs when nothing is connected.
Make sure that the Pot is plugged into the right pin. In Kevin's ADC, #1 is actually analog in #2 (#0 is pin #1). |
Re: HELP: analog input
we did what you said but it still counts.
can any body please send us a working code for the potentiometer using the analog inputs. |
Re: HELP: analog input
Quote:
Potentiometervalue = Get_Analog_Value(rc_ana_in01); |
Re: HELP: analog input
Quote:
-Kevin |
Re: HELP: analog input
We have tried both things, with Kevin's code and it still did not work...
any further suggestions? |
Re: HELP: analog input
Is your potentiometer wired correctly? Red and black to the outer leads, white (signal) to the center? The problem you described only occurs when nothing is plugged in, so make sure you're referencing the correct analog input in your code, that the pot is wired correctly, and that it's not broken (which is kind of hard to do.. test another one?).
|
Re: HELP: analog input
We tested it with a voltmeter and it all good....
|
Re: HELP: analog input
Quote:
|
Re: HELP: analog input
the potentiometers are good like i said...
We have checked it with a voltmeter connecting between the where the white cable connects and where the red one connects and it shows the correct results. We have also tried to change the ports, and neither of them worked... |
Re: HELP: analog input
Quote:
Quote:
A potentiometer on the Robot Controller's analog inputs needs three wires. Black (ground) goes to one end of the pot. Red (+5) goes to the other end of the pot. White (signal) goes to the wiper. |
Re: HELP: analog input
Like i said before...its connected CORRECTLY...
There is another problem... Black goes to left side of potentiometer Red goes to its right leg and white goes to the middle one... and they connect to the analog inputs correctly We have measured voltages between red and white legs, and it shows inputs from 0 to 4.95V liniarically to the rotation i make... Here's our code: printf("%u",Get_Analog_Value(rc_ana_in01)); does not work with %d or %u.... could you show me the code of Get_Analog_value...perhaps the problem we have has to with that function... |
Re: HELP: analog input
I don't know this first hand, but does the analog port need to be setup as an input somewhere? Does the ADC need to be enabled?
ttyl, --buddy |
Re: HELP: analog input
Make sure you are calling the function
Code:
Set_Number_of_Analog_Channels(SIXTEEN_ANALOG); /* DO NOT CHANGE! */Good luck. |
Re: HELP: analog input
Okay, here is code from our robot this year. This is exactly how we have written it and it works.
We made variables on top of the file: Code:
unsigned int BottomSonic = 0;Code:
Also, try it on a fresh piece of code with the absolute default code from IFI. |
Re: HELP: analog input
Make sure your init functions are correct.
and call the get_analog_value() |
Re: HELP: analog input
Quote:
|
Re: HELP: analog input
I have been having the exact same issue. I tried IFI's ADC, Kevin Watson's integrated into my code, Kevin Watson's from his website(unmodified), and whatever EasyC uses.
They all read 0. I have tried both the 2006 and 2007 controllers. I have the pot connected so the 5v+/gnd each connect to one side of the pot, and the signal is connected to the middle connector on the pot. If I short the gnd/sig pins the reading does NOT change. I have used Kevin Watson's ADC without any issues before now. I have run it on VEX, EDU, and 2005 controllers. I was at the Sussex mini-regional today and talked to 4-5 other programmers, and none of them had any ideas. What am I missing? Thanks, Eric Haskins |
| All times are GMT -5. The time now is 03:11. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi