|
Re: Analogs.....
Seems like your answer has been given, but I have a tad more things to add.
As many have said, an analog input is a range of values. If you have a 10 bit ADC (Analog to Digital Converter) it will be a 10 bit number (0 to 1023), 8 bit ADC is 0 to 254, etc. Our controller has a 10 bit ADC.
Analog devices work by taking a voltage in, applying resistance to it depending on a mechanical device and then outputting the modified voltage. That modified voltage is connected to the input pin of an ADC. The ADC is also connected to what is called a reference voltage. This reference voltage is what the inputted voltage will be compared to. It's kinda hard to explain, examples show it better:
Reference voltage: 5v
Input voltage: 5v
ADC: 10 bit
Output given: 1023
Reference voltage: 5v
Input voltage: 5v
ADC: 8 bit
Output given: 254
Reference voltage: 5v
Input voltage: 0v
ADC: 10 bit
Output given: 0
Reference voltage: 5v
Input voltage: 2.5v
ADC: 10 bit
Output given: 511Thanks Joe =)
So what it comes down to is: (InputVoltage / RefVoltage) * ADCsize
Hope I helped,
Mike
Last edited by Mike : 18-01-2006 at 12:44.
|