The ADC provides the ability to measure analog voltages at 10-bit resolution. The SAMD09 seesaw has 4 ADC inputs, the Attiny8x7 has 11 ADC inputs.
The module base register address for the ADC is 0x09
Conversions can be read by reading the corresponding CHANNEL register.
When reading ADC data, there should be at least a 500 uS delay between writing the register number you would like to read from and attempting to read the data.
Allow a delay of at least 1ms in between sequential ADC reads on different channels.
SAMD09 ADC channels are:
Channel 0 |
PA02 |
Channel 1 |
PA03 |
Channel 2 |
PA04 |
Channel 3 |
PA05 |
ATtiny8x7 ADC channels are:
- Channel 0: PA4
- Channel 1: PA5
- Channel 2: PA6
- Channel 3: PA7
- Channel 6: PB5
- Channel 7: PB4
- Channel 10: PB1
- Channel 11: PB0
- Channel 18: PA1
- Channel 19: PA2
- Channel 20: PA3
(These are the same as the Arduino GPIO pin names for the ADCs in megaTinyCore)
Register Address |
Register Name |
Register Size |
Notes |
0x00 |
STATUS |
8 bits |
Read Only |
0x02 |
INTENSET |
8 bits |
Write Only |
0x03 |
INTENCLR |
8 bits |
Write Only |
0x04 |
WINMODE |
Write Only |
|
0x05 |
WINTHRESH |
32 bits |
Write Only |
0x07 |
CHANNEL_0 |
16 bits |
Read Only |
0x08 |
CHANNEL_1 |
16 bits |
Read Only |
0x09 |
CHANNEL_2 |
16 bits |
Read Only |
0x0A |
CHANNEL_3 |
16 bits |
Read Only |
... |
... |
... |
... |
0x1B |
CHANNEL_20 |
16-bit |
Read Only |
Bit 7 |
Bit 6 |
Bit 5 |
Bit 4 |
Bit 3 |
Bit 2 |
Bit 1 |
Bit 0 |
Reserved |
Reserved |
Reserved |
Reserved |
Reserved |
Reserved |
WINMON_INT |
ERROR |
INTENSET (0x02, 8bits, Write Only)
Writing a 1 to any bit in this register enables the corresponding interrupt.
Writing zeros to this register has no effect.
Bit 7 |
Bit 6 |
Bit 5 |
Bit 4 |
Bit 3 |
Bit 2 |
Bit 1 |
Bit 0 |
Reserved |
Reserved |
Reserved |
Reserved |
Reserved |
Reserved |
Reserved |
WINMON |
INTENCLR (0x03, 8bits, Write Only)
Writing a 1 to any bit in this register enables the corresponding interrupt.
Writing zeros to this register has no effect.
WINMODE (0x04, 8bits, Write Only)
Writing 1 to this register sets window control.
WINTHRESH (0x05, 32bits, Write Only)
This register sets the threshold values for window mode.
Bits 31 - 16 |
Bits 15 - 0 |
High Threshold |
Low Threshold |
CHANNEL_0 (0x07, 16bits, Read Only)
ADC value for channel 0
CHANNEL_1 (0x08, 16bits, Read Only)
ADC value for channel 1
CHANNEL_2 (0x09, 16bits, Read Only)
ADC value for channel 2
CHANNEL_3 (0x0A, 16bits, Read Only)
ADC value for channel 3
...
CHANNEL_20 (0x1B, 16bits, Read Only)
ADC value for channel 20
Page last edited March 08, 2024
Text editor powered by tinymce.