-
Notifications
You must be signed in to change notification settings - Fork 7
ADC_start_conversion
gicking edited this page Feb 8, 2018
·
1 revision
back to Command Reference / Analog-IO
Start ADC measurements for continuous conversion (see ADC_init()). Use measurement channel set via ADC_set_channel().
Notes:
- Only pins marked as
AINx
in respective device datasheet have ADC capability. - For accurate ADC results configure the respective pin as
INPUT
via pinMode() -
ADC_start_conversion()
has no effect in single shot mode - continuous ADC conversion consumes comparatively high power --> use single-shot mode in energy sensitive applications
- defined in
adc.h
-
not loaded by
main_general.h
- no
#define
required
ADC_start_conversion()
-
input:
- none
-
output:
- none
- Nothing
The below code initializes the ADC for continuous measurements of pin AIN5
.
#include "main_general.h"
#include "adc.h"
void setup()
{
ADC_init(ADC_CONTINUOUS);
ADC_set_channel(5);
ADC_start_conversion();
}
void loop()
{
uint16_t result;
if (ADC_check_conversion_flag()) {
result = ADC_get_result(5);
ADC_reset_conversion_flag();
}
// ...do something with it
delay(100);
}
- tbd
To avoid damage
- do not expose I/Os to voltages outside [-0.3V; Vdd+0.3V], else limit injection currents to the specificied limits
-
Getting Started
-
- General Commands
- Libraries
- LCD BTHQ21605V
- poti AD5280
- poti AD5282
- freemodbus
- PetitFS SD-card (min)
- FatFS: SD card (full)
- Board Specific
-
- Universal
- Board Specific