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.

ADC variable is always stored with values



Hi guys, 

My ADC variable is always stored with random values even when I am not sending any input through the port that I am using, PB5

I did not send any input at all, I just power on my board and i debugged it. The first '0' I've gotten was before I run the program... 

  • Those addresses are all w/in MCU's SRAM - unless your program - or the MCU's default behavior - "clears" that memory area - what you note is expected.

    If we assume that you've fed that MCU's ADC input w/the same signal - it's likely that your VDDA, VSSA and/or your external analog signal handling - are sub-optimal.   (the large variation (26 our of ~200) in your ADC variable so advises.)  

    There are many posts (here) detailing the "care/handling" of external analog signals prior to their "introduction" to the MCU's ADC.  (look especially for poster "Robert.")

  • Hello Domenic,

    The same variable is showing 4 different values (the variable is at the same address). Are you not refreshing the value after the conversion?

    Regards
    Amit
  • Domenic Pang said:
    I did not send any input at all

    Does this mean the input pin is floating? IE not connected to anything.

    Robert