Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

Do the analog inputs work on an ATMega328?

2 posters

Go down  Message [Page 1 of 1]

cascovida



Hello, I am new to the forum. First of all sorry for my English. I am using SimulIde 1.0.0-SR0_Lin64 with the Arduino framework. Using Nano, Mega or Uno I have no problems with analog inputs, But on the Atmega 328 DIP I don't get any reading with analogRead(). why can it be due?
Thank you.

arcachofo

arcachofo

Hi.
But on the Atmega 328 DIP I don't get any reading with analogRead(). why can it be due?
Probably because you need to connect Avcc (A+) and Aref (Ar) to 5V (or whatever voltage you need).

cascovida



Hi. Perhaps I have expressed myself badly. The problem is that using SimulIDE_1.0.0-SR0_Lin64 the analog inputs of the atmega328 are not working. The analog inputs of the Mega, Nano and Uno do. In simulide_0.4.15-SR9 the analog inputs of the atmega 328 do work.
Is it a problem of the version? Thank you.

arcachofo

arcachofo

I think I understood the problem, but you didn't share your circuit and code, so I'm just guessing.
With the information you provide the most likely problem is that you didn't connect Avcc and/or Aref.
Did you do?

cascovida



Ok, excuse me. English is not my language and I didn't understand you well. I have connected the A+ pin to a voltage source and now it works. Should I also connect Ar? Or I can use it to set another reference voltage value? Thank you very much and sorry for the mistake.

arcachofo

arcachofo

Should I also connect Ar? Or I can use it to set another reference voltage value?
That depends on what you want to do.
Here is some information about Atmega ADC:
https://ww1.microchip.com/downloads/en/Appnotes/atmel-8456-8-and-32-bit-avr-microcontrollers-avr127-understanding-adc-parameters_application-note.pdf

cascovida



Ok, I'll start reading it.
Thank you very much and best regards

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum