hi,
I want to use DAC in esp32. How to initialize and work on that? Can anyone give me a suggestion on that?
esp32 DAC
-
- Posts: 1
- Joined: Mon Dec 05, 2016 8:16 pm
Re: esp32 DAC
Hi Kamesh, adapt this... The duration of conversion is aroud 47uS. With 12dB attenuation, you can measure up to 4 volts ( a bit more...)
Have fun....
uint16_t data;
enum adc1_pad {
ADC1_GPIO36 = 0,
ADC1_GPIO37,
ADC1_GPIO38,
ADC1_GPIO39,
ADC1_GPIO32,
ADC1_GPIO33,
ADC1_GPIO34,
ADC1_GPIO35
};
enum adc1_atten {
ADC1_ATTEN_0DB = 0,
ADC1_ATTEN_3DB,
ADC1_ATTEN_6DB,
ADC1_ATTEN_12DB
};
uint32_t adc1_read(enum adc1_pad pad, enum adc1_atten att);
data= adc1_read(ADC1_GPIO35, ADC1_ATTEN_12DB);
printf("%d\t%d\n", i, data); //47uS
Have fun....
uint16_t data;
enum adc1_pad {
ADC1_GPIO36 = 0,
ADC1_GPIO37,
ADC1_GPIO38,
ADC1_GPIO39,
ADC1_GPIO32,
ADC1_GPIO33,
ADC1_GPIO34,
ADC1_GPIO35
};
enum adc1_atten {
ADC1_ATTEN_0DB = 0,
ADC1_ATTEN_3DB,
ADC1_ATTEN_6DB,
ADC1_ATTEN_12DB
};
uint32_t adc1_read(enum adc1_pad pad, enum adc1_atten att);
data= adc1_read(ADC1_GPIO35, ADC1_ATTEN_12DB);
printf("%d\t%d\n", i, data); //47uS
Who is online
Users browsing this forum: Blitz54 and 142 guests