Page 1 of 1

AREF

Posted: 25 Feb 2024 11:08
by stari
Internal reference
I want to use the internal reference on the atmega328p, but I can't seem to get it to work. I used:
ADC_Init_Advanced(_ADC_INTERNAL_REF)

If I connect AREF to an external voltage, via a resistor and a 2.2V zener diode, then I can read the voltage on PC0, otherwise I always get the value 1023.

Any hint?

Re: AREF

Posted: 17 Mar 2024 19:32
by IvanJeremic
Hi,

Sorry for the delay.

Can you share your project, and can you tell me what development board you are using?

Regards,

Ivan.

Re: AREF

Posted: 29 Mar 2024 07:32
by stari
Hi
I work on EASY AVR V7.
But i have found the solution:
Every time i wish to read the voltage i do:
ADC_Init_Advanced(_ADC_INTERNAL_REF)
Delay_50us
voltage = ADC_Read(0)
Delay_50us

So i initialize ADC every time.
This works.

Thank you.