analogSetCycles, analogSetSamples

Brain Scientist
Posts: 4
Joined: Thu Aug 15, 2019 10:15 pm

analogSetCycles, analogSetSamples

Postby Brain Scientist » Fri Aug 16, 2019 1:58 pm

Can someone provide detailed descriptions of analogSetCycles() and analogSetSamples()? Please don't say "sets the number of samples in the range" or "sets the number of cycles per sample". I have looked at the Arduino source code, but that led to a dead end trying to use the ESP32 documentation. My best guess is that analogSetSamples() does some sort of repeated sampling of a single channel (oversampling) to effectively increase the number of bits of resolution. I can't guess at analogSetCycles(). Clock cycles? Perhaps these both have to do with redundantly listing a channel in the DIG SAR ADC scan table. Note, you cannot search the forums for these functions because there are too many hits. Apparently, these function are in everyone's ADC code. Thanks.

noweare
Posts: 3
Joined: Tue Jul 02, 2019 11:35 am

Re: analogSetCycles, analogSetSamples

Postby noweare » Sun Aug 02, 2020 3:01 am

Set cycles refers to sampling time i.e. how long to to sample the input in clock cycles.

Set Samples, should be to take a number of samples and average the result but I don't really know.

One thing I know is if I use analogSetSamples in my code my adc return widely varying values.
For,example if I slowly move the potentiometer to lower values I get higher and lower values back from the
adc. I should be consistanly smaller values. When I take that line out, things work like they are supposed to.

Who is online

Users browsing this forum: SO_yeah and 14 guests