11 years, 6 months ago.

ADC conversion

Hello, am new to mbed environment and lately am working on a project to read and store a strain gauge value. everything seems working except ADC always put zero to the output all the time. below is part of the code for ADC conversion

ADC adc (150000,1); .... while (1) { adc.setup(p20,1); adc.select(p20); adc.start(); while(!adc.done(p20)); wait(1); fprintf (fpp,"%05f\n\r", adc.read(p20)); }

after having this compiled, checked it with 3.3v out from mbed p40 tp p20 but the output value is always 0.0000. so are there any thing else to setup. please help me figure out.

2 Answers

11 years, 6 months ago.

Please put code between <<code>> and <</code>>

Next question is which ADC lib are you using? I guess http://mbed.org/users/simonb/code/ADC_test/. Then the first question is, why that one, and not just AnalogIn? That library has some significant advantages in the speed department over the normal AnalogIn function, however generally strain gauges do not need to be read out at very high speeds.

If you use AnalogIn on p20, does it work?

11 years, 6 months ago.

hey, sorry for the late response. i have tried using the AnalogIn as you suggested and amazingly starts to have read different values. thank you so much for the big help.