9 years, 8 months ago.

AnalogIn Resolution

Can anyone tell me the resolution of the analog in function.

If the read() function has a range of 0.0-1.0 would that mean there is only a 10 step resolution available?

I am using a Nucleo 401 which has a 12bit ADC. Can the AnalogIn() be used to read the entire 12bit resolution?

Question relating to:

1 Answer

9 years, 8 months ago.

First question: No. Second one: Yes. It uses the full resolution, and read will have 4096 steps (12-bit resolution)

Accepted Answer

OK Erik, where is the code which sets the analog resolution and is it possible to change AD parameters. Regards Jim

posted by James Dudley 21 Mar 2017

Deep in the source code ;). For your device here: https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/analogin_api.c

And yeah, it is possible to change the AD parameters, but not via the mbed API. Sometimes you can make for example an AnalogIn, change parameters via either register access or an alternative driver lib, and then continue using AnalogIn. Other times you will then have to do everything via an alternative library / your own code.

The mbed API is intended to simplify access (which is why I disagree with some recent design decissions), and more important standardize it for different targets. So AnalogIn is just a simple, straight forward, API.

posted by Erik - 21 Mar 2017