hello,
I am facing with stability in the ADC value .
I put a variable resistor betwen the Vout 3.25V and ground. The 3rd pin is connected to the P15 (analog input).
after moving the cursor I have 1.6V for example on the P15.
I send the result to the serial via USB PC and in Tere Term
P15 value 19204 P15 value 18116 P15 value 19476 P15 value 20132 P15 value 18420 P15 value 18420 P15 value 20196 P15 value 19396 P15 value 18116
Here is the code used
#include "mbed.h"
AnalogIn Temperature(p15);
Serial pc(USBTX, USBRX);// tx, rx
int main() {
unsigned int LUI_Temperature=0;
while(1) { LUI_Temperature = (Temperature.read_u16());
pc.printf("P15 value %d",LUI_Temperature);
}
}
I do not understand why I have some much variation in the value get from ADC.
How are coded the 12 bits return by ADC in the variable ( bit 15 to bit 4o or bit 11 to bit 0 )?
If some has some idea?
Additional information, when you put 0V impossible to get something close to !
When you put 3.3V impossible to get something close to 65535 !
A+
Sares
Hi,
I'm new to mbed platform, so maybe my question is not good.
I took a look at the MCU datasheet and I saw that I can put the ADC in 10 bits mode. I was wondering how I can do that with the mbed library.
Thanks in advance :)