Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
I just benchmarked the AnalogIn performance on several of my microcontrollers, and the LPCXpresso11U68 board is extremely slow! I measured 176µs for a floating point reading, and 173µs for an 16-bit integer reading. By comparison, the LPC11U24 (which has basically the same peripherals as the LPC11U68) only takes 18µs for a floating point reading, and 14µs for an 16-bit integer reading. Something is clearly amiss here... I've opened an issue over at GitHub, and I've attached my benchmark code and findings in case anyone is interested:
main.cpp
#include "mbed.h" Timer timer; AnalogIn adc(A0); int main() { float a = 0.0; unsigned short b = 0; printf("\nTesting floating point A/D performance...\n\n"); timer.start(); for (int i = 0; i < 1000000; i++) { a = adc.read(); } timer.stop(); printf("\tResult (%f): %fus\n", a, timer.read_us() / 1000000.0); timer.reset(); printf("\nTesting integer A/D performance...\n\n"); timer.start(); for (int i = 0; i < 1000000; i++) { b = adc.read_u16(); } timer.stop(); printf("\tResult (0x%X): %fus\n", b, timer.read_us() / 1000000.0); timer.reset(); }