Page 1 of 1

esp32 DAC

Posted: Wed Dec 21, 2016 1:42 pm
by kamesh
hi,

I want to use DAC in esp32. How to initialize and work on that? Can anyone give me a suggestion on that?

Re: esp32 DAC

Posted: Thu Dec 22, 2016 2:08 pm
by dgrenier67
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