Analog Inputs
When reading analog signals the microcontroller converts the voltage to digital signals using analog to digital conversion (ADC).
The simplest conversation is that of a single input. The signal is converted to a digital signal and stored in a register on the microcontroller. This value is used by the deployed code to reconstruct the analog signal.
In some microcontrollers, it is also possible to use differential channels and amplify the signal before doing the conversion.
The signals and must be positive.
It is possible to use the voltages , , , or as the input signal.
"c"<"Type""Analog" > | Ain |
{"c+","c-"}<… > | ΔAin |
"c+" <…,"NegativeDifferentialInput""c-",… > | Ain+, assuming Ain- is 0 |
"c+" <…,"NegativeDifferentialInput" "c-"v,… > | Ain+, assuming Ain- is v |
"c-" <…,"PositiveDifferentialInput" "c+",… > | Ain-, assuming Ain+ is Ref |
"c-" <…,"PositiveDifferentialInput" "c+"v,… > | Ain-, assuming Ain+ is v |
c<…,"Gain""g",… > | use gain "g" |
c<…,spi,… > | use specifications spi |
It may be possible to specify additional options for the ADC conversion. They include "Reference" and "Prescaler".
The following values can be given for the ADC reference voltage:
"AVCC" or Automatic | voltage Vcc at analog voltage pin AVCC |
"AREF"aref | voltage aref at the analog reference pin AREF |
"Internal" | internal reference voltage |
Reference voltage for analog inputs.
The ADC may need to happen at a different speed than the microcontroller's system clock speed. There is a prescaler that can be used to do the conversion at the appropriate speed. The prescaler value is automatically selected based on the system clock frequency and information in the datasheet. This value can also be explicitly specified.