at90pwm81-16se ATMEL Corporation, at90pwm81-16se Datasheet - Page 216

no-image

at90pwm81-16se

Manufacturer Part Number
at90pwm81-16se
Description
8-bit Avr Microcontroller With 8k Bytes In- System Programmable Flash
Manufacturer
ATMEL Corporation
Datasheet
18.8
18.8.1
216
ADC Register Description
AT90PWM81
ADC Multiplexer Register – ADMUX
Table 18-2.
Example 1:
Example 2:
The ADC of the AT90PWM81 is controlled through 3 different registers. The ADCSRA and The ADC-
SRB registers which are the ADC Control and Status registers, and the ADMUX which allows to select
the Vref source and the channel to be converted.
The conversion result is stored on ADCH and ADCL register which contain respectively the most signifi-
cant bits and the less significant bits.
Bit
Read/Write
Initial Value
V
V
V
...
V
V
V
...
V
V
V
ADCn
ADCm
ADCm
ADCm
ADCm
ADCm
ADCm
ADCm
ADCm
– ADMUX = 0xED (ADC3 - ADC2, 10x gain, 2.56V reference, left adjusted result)
– Voltage on ADC3 is 300 mV, voltage on ADC2 is 500 mV.
– ADCR = 512 * 10 * (300 - 500) / 2560 = -400 = 0x270
– ADCL will thus read 0x00, and ADCH will read 0x9C.
– ADMUX = 0xFB (ADC3 - ADC2, 1x gain, 2.56V reference, left adjusted result)
– Voltage on ADC3 is 300 mV, voltage on ADC2 is 500 mV.
– ADCR = 512 * 1 * (300 - 500) / 2560 = -41 = 0x029.
– ADCL will thus read 0x40, and ADCH will read 0x0A.
+ 0.999 V
+ 0.998 V
+ 0.001 V
- 0.001 V
- 0.999 V
- V
+ V
Writing zero to ADLAR right adjusts the result: ADCL = 0x70, ADCH = 0x02.
Writing zero to ADLAR right adjusts the result: ADCL = 0x00, ADCH = 0x29.
REF
REF
/GAIN
7
REFS1
R/W
0
/GAIN
Correlation Between Input Voltage and Output Codes
REF
REF
REF
REF
REF
/GAIN
/GAIN
/GAIN
/GAIN
/GAIN
6
REFS0
R/W
0
5
ADLAR
R/W
0
Read code
0x1FF
0x1FF
0x1FE
0x3FF
0x001
0x000
0x201
0x200
...
...
4
-
-R
0
3
MUX3
R/W
0
Corresponding decimal value
511
511
510
...
1
0
-1
...
-511
-512
2
MUX2
R/W
0
1
MUX1
R/W
0
0
MUX0
R/W
0
7734M–AVR–03/10
ADMUX

Related parts for at90pwm81-16se