Results 1 to 3 of 3

Thread: Wemos ADC Operation

  1. #1
    Join Date
    May 2007
    Posts
    5,628
    Post Thanks / Like

    Default Wemos ADC Operation

    I'm under the impression that, like most microcontrollers with ADCs, the ESP CPU writes to a hardware register to start an ADC conversion. The ADC conversion finishes some time later, and the 8266 system function system_adc_read blocks during this time interval. I've read somewhere that them maximum conversion rate is on the order of 100 Kps, which would put the system dead-time of about 10uS while the conversion is in progress. How accurate is this understanding? Is there some way for an application (sketch/library) to return immediately after starting the conversion and be interrupted later when the result is available (other than by using a timer interrupt)?
    Phil

  2. #2
    Join Date
    Jan 2021
    Posts
    130
    Post Thanks / Like

    Default Re: Wemos ADC Operation

    I found this for Arduino (looks like a Mega to me):

    void setup(){
    Serial.begin(115200);
    adcAttachPin(35);
    adcAttachPin(25);
    }

    void loop(){
    //start 1 pin for each ADC bus
    adcStart(35);
    adcStart(25);
    //you can check adcBusy(pin), but adcEnd will wait anyway
    uint16_t a0 = adcEnd(35);
    uint16_t a1 = adcEnd(25);
    Serial.printf("ADC: %u, %u\n", a0, a1);
    }


    But I cannot vouch for how that works exactly with Wemos.

  3. #3
    Join Date
    May 2007
    Posts
    5,628
    Post Thanks / Like

    Default Re: Wemos ADC Operation

    Thanks, I'll try that out.
    Phil

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •