We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I did some testing with the below sketch I get results that don't make sense to me. These results are from a teensy 4.1 underclocked to 24MHz.
Can you please help me understand why the adc->adc0->analogRead() alternating is nearly half the speed of analogRead() when including your library?
1 - Standard analogRead() - 91us 2 - #include adc.h using adc->adc0->analogRead() and adc->adc1->analogRead() - 31us 3 - #include adc.h using analogRead() - 19us
#include <ADC.h> #include <ADC_util.h> unsigned long start = 0; unsigned long stop = 0; int readPin0 = A0; int readPin1 = A1; int readPin2 = A2; int readPin3 = A3; ADC *adc = new ADC(); void setup() { pinMode(LED_BUILTIN, OUTPUT); pinMode(readPin0, INPUT_DISABLE); pinMode(readPin1, INPUT_DISABLE); pinMode(readPin2, INPUT_DISABLE); pinMode(readPin3, INPUT_DISABLE); Serial.begin(9600); ///// ADC0 //// adc->adc0->setAveraging(0); // set number of averages adc->adc0->setResolution(10); // set bits of resolution adc->adc0->setConversionSpeed( ADC_CONVERSION_SPEED::VERY_HIGH_SPEED); // change the conversion speed adc->adc0->setSamplingSpeed( ADC_SAMPLING_SPEED::VERY_HIGH_SPEED); // change the sampling speed ////// ADC1 ///// adc->adc1->setAveraging(0); // set number of averages adc->adc1->setResolution(10); // set bits of resolution adc->adc1->setConversionSpeed( ADC_CONVERSION_SPEED::VERY_HIGH_SPEED); // change the conversion speed adc->adc1->setSamplingSpeed( ADC_SAMPLING_SPEED::VERY_HIGH_SPEED); // change the sampling speed delay(500); } int value1 = 0, value2 = 0, value3 = 0, value4 = 0; int pin = 0; void loop() { start = micros(); //value1 = adc->adc0->analogRead(readPin0); //value2 = adc->adc1->analogRead(readPin1); //value3 = adc->adc0->analogRead(readPin2); //value4 = adc->adc1->analogRead(readPin3); value1 = analogRead(readPin0); value2 = analogRead(readPin1); value3 = analogRead(readPin2); value4 = analogRead(readPin3); stop = micros() - start; Serial.println(); Serial.print("time - "); Serial.print(stop); Serial.println(); Serial.print(value1); Serial.print(", "); Serial.println(value2); Serial.print(value3); Serial.print(", "); Serial.println(value4); Serial.println(); delay(200); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When I did some testing with the below sketch I get results that don't make sense to me. These results are from a teensy 4.1 underclocked to 24MHz.
Can you please help me understand why the adc->adc0->analogRead() alternating is nearly half the speed of analogRead() when including your library?
1 - Standard analogRead() - 91us
2 - #include adc.h using adc->adc0->analogRead() and adc->adc1->analogRead() - 31us
3 - #include adc.h using analogRead() - 19us
The text was updated successfully, but these errors were encountered: