esp32 DAC

kamesh
Posts: 35
Joined: Sat Aug 06, 2016 5:14 am

esp32 DAC

Postby kamesh » Wed Dec 21, 2016 1:42 pm

hi,

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

dgrenier67
Posts: 1
Joined: Mon Dec 05, 2016 8:16 pm

Re: esp32 DAC

Postby dgrenier67 » Thu Dec 22, 2016 2:08 pm

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

Who is online

Users browsing this forum: No registered users and 103 guests