Update for 15-11-21 16:00
This commit is contained in:
parent
364399d85f
commit
f3c6b20c35
@ -236,4 +236,34 @@ NOTE to help with calculations, 0xFFFF is 65536 and 0xFF is 256
|
||||
| 256 | 62500 |
|
||||
| 1024 | 15625 |
|
||||
|
||||
=== Analog to Digital ===
|
||||
|
||||
The ATMega328P includes an [[ADC]] for reading analog inputs. The ADC, like
|
||||
everything else, is controlled via several control registers.
|
||||
|
||||
The primary control register is the ADC Multiplexer Selection Register (ADMUX
|
||||
0x7C). Bit 7 and 6 select the reference voltage for the ADC. Any updates to
|
||||
this register do not take effect till after an ongoing ADC operations has
|
||||
completed. The internal voltage reference may not be used if a voltage is
|
||||
applied across the AREF pin. Below are valid values for bits 7 and 6
|
||||
|
||||
| Bits (7-6) | Description |
|
||||
----------------------------
|
||||
| 00 | AREF, internal reference voltage turned off |
|
||||
| 01 | AV,,cc,,, with an external capactior on AREF |
|
||||
| 10 | Reserved (non functioning) |
|
||||
| 11 | Internal 1.1V reference used with capactior on AREF |
|
||||
|
||||
Bit 5 of ADMUX changes the presentation of the ADC result, and when set to one
|
||||
(1) the value will be left adjusted, otherwise it will be right adjusted. This
|
||||
change happens instantly, regardless of the actions in the ADC
|
||||
|
||||
Bits 3-0 set which ADC pin will be converted (NOTE these are the pins on PortC
|
||||
on the Arduino Nano). For values 0 through 7 (binary values in bits 3-0), will
|
||||
select the corresponding ADC pin. 0b1000 is a sepcial ADC, connected to the
|
||||
internal temperture sensor. 0b1110 (10d14) is the internal reference voltage of
|
||||
1.1V, and 0b1111 (10d15) is internal reference GND (0V). All non mentioned
|
||||
values are not used
|
||||
|
||||
To control the ADC, the ADC control and Status Register A (ADCSRA 0x7A) and ADC
|
||||
Control and Status Register B (ADCSRB 0x7B) are used.
|
||||
|
Loading…
Reference in New Issue
Block a user