9 years, 6 months ago.

What does normalized to 16-bit value mean?

STM32 Arm MCU's have 12-bit ADC's. so 0x0 to 0xFFF. What happens when it's normalized to 16-bits? This doesn't change the number of steps the MCU ADC has so how do I use this?

Please give an example. the ST MCU's go from 0 to 3.3V, in 4096 steps.

Thanks.

Felix

Question relating to:

1 Answer

9 years, 6 months ago.

Each step becomes larger, so it is mapped between 0x0 and 0xFFFF.

Accepted Answer

there's a lot more steps between 0x0 and 0xFFFF. Do I just spread out the 4096 steps into 0xFFFF? I mean it's still a 12 bit DAC...

posted by Felix Su 11 Oct 2014

Yes, that is what is being done. If you want the original raw data, just shift it 4 positions to the right (data >> 4), and you got that again.

posted by Erik - 11 Oct 2014

So, is that between 0x0 and 0xFFF0 instead of between 0x0 and 0xFFFF ?

posted by Yoshi Mimura 11 Oct 2014

Nop, it also adds the 4 MSBs to the LSB position. The formula used to get the 16-bit value is:

value = ((value << 4) & (uint16_t)0xFFF0) | ((value >> 8) & (uint16_t)0x000F);

But to get the raw code just shifting 4 to the right will do.

posted by Erik - 11 Oct 2014