AREF

Fully featured AVR compilers available on Windows, Linux, and macOS.
Post Reply
Author
Message
stari
Posts: 75
Joined: 01 Feb 2012 08:59

AREF

#1 Post by stari » 25 Feb 2024 11:08

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?

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: AREF

#2 Post by IvanJeremic » 17 Mar 2024 19:32

Hi,

Sorry for the delay.

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

Regards,

Ivan.

stari
Posts: 75
Joined: 01 Feb 2012 08:59

Re: AREF

#3 Post by stari » 29 Mar 2024 07:32

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.

Post Reply

Return to “AVR AI Compilers”