7 years, 3 months ago.

About the LPC4088 ADC

Hi,everyone thx for watching my question. i have a code problem about LPC4088 ADC. i search the ADC conversion rate is 400KHz. http://docs.lpcware.com/lpcopen/v1.03/group___e_x_a_m_p_l_e_s___p_e_r_i_p_h__17_x_x40_x_x___a_d_c.html. This is my code. And i don't know which code i should add into . Just like the conversion rate set.

#include "mbed.h"
AnalogIn   current(p20);
int main() {    
       while(1) {
        printf("\n ADC Val : %f",(current.read_u16())*3.3/4095);
        wait(0.2);
    }
}

Thx very much!!!

1 Answer

7 years, 3 months ago.

The mbed AnalogIn function simply does one conversion when you call it, with some overhead. So you will never reach the full speed.

More over, what are you going to do with your data? Since a printf takes with default settings about 1ms per character. So there is no way you can print 400000 lines of that per second.

Anyway there are libs which allow you more control over the ADC and/or faster speed. One is mine for example: https://developer.mbed.org/users/Sissors/code/FastAnalogIn/. But there are also others, those who work for the LPC1768 also probably work for the LPC4088, with minor modifications at most.