This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP432P401R: ADC14 float value

Part Number: MSP432P401R

Hi!

I'm trying to send through UART the ADC sample value converted to float. I read this post:

However, I can't figure out which value I could get. I read from page 12 of DriverLib manual that if I set my ADC with 14 bit resolution and a positive reference of 2.5V (and a negative 0V), the conversion value of 16383 corresponds to 2.5V in unsigned mode. I would like to ask you two questions:

1) if I receive as ADC value an uint16_t, it means that I’m in unsigned mode?

2) As from your example in Resource Explorer, I set the reference voltage to 2.5V with these lines

    //![Simple REF Example]
    /* Setting reference voltage to 2.5  and enabling reference */
    MAP_REF_A_setReferenceVoltage(REF_A_VREF2_5V);
    MAP_REF_A_enableReferenceVoltage();
    //![Simple REF Example]

and then I configured my ADC with

MAP_ADC14_configureConversionMemory(ADC_MEM0, ADC_VREFPOS_INTBUF_VREFNEG_VSS,ADC_INPUT_A0, false);

With this line of code I set the voltage range of the ADC among 0 and 2.5V? (and then I will have a non negative values in output?)

Thank you,

Best regards,

Mattia Ducci

  • Mattia,
    Your understanding is correct. If you set up the ADC in 14bit mode using the 2.5v reference the ADC will output a value between 0 and 16383 for voltage inputs between 0V and 2.5v, respectively. The value will be unsigned.
    Regards,
    Bob
  • Thank you for your answer!
    But in my code is necessary I do the conversion between the uint16_t value of adc to float? Can't I send (throug UART for example) directly the adc value and assume that this is beetween 0 and 16383?
    Beste regards,
    Mattia
  • Mattia,
    Yes, In this case it would be better to convert the value to a float once you've transferred it through UART to the other system. (Since a float is at least 4 bytes and this ADC value is only 2 bytes, it's more efficient to transfer it in raw form and map the 0-16383 value to a 0-2.5v float at the receiving end.
    Regards,
    Bob
  • You saved me.
    Thank you very much!
    Best regards,
    Mattia
  • Hi! I'm sorry, can I ask you one more thing?

    Before sampling with msp I tried to sample my sensor with an USB audio interface and the signal was bipolar. Here's the recording

    Doing the same thing with msp (this is a python plot of the value sent by UART in uint16_t format) I obtain this result:

    It seems that the signal became unipolar, and I think it's good because I've an unsigned int, but I would expect that the noise was in the middle of the plot (on the y axis the values are the same as the unnormalized ones out of the ADC). 

    How can I read these results?

    Thank you very much,

    best regards,

    Mattia

  • Mattia,
    I'd really need to see a schematic diagram of how you're receiving and converting these signals. And, since this is a somewhat different topic, can I ask that you file this as a new post rather than extending this one? (It makes it easier to track specific topics later).
    Regards,
    Bob
  • You're right, I'm sorry! But I'm figured out what the problem was: my audio interface deleted the offset and applied a band-pass filter.. so the signal resulting from msp I think was right. Thank you very much for all your help,
    Best regards,
    Mattia

**Attention** This is a public forum