2
\$\begingroup\$

does Arduino Mega2560 (based on ATMega 2560) has an input pull-up on analog inputs? Can I set the input pull-up as usual by software?

The reason is that I need to use the analog pins as extra digital inputs.

\$\endgroup\$
3
  • \$\begingroup\$ The reason is I am using an analog pin as digital pin and I need a pull-up on that pin \$\endgroup\$
    – piertoni
    Jun 2, 2016 at 13:56
  • \$\begingroup\$ If you are using it as a digital input, then it is NOT an "analog pin". So the premise of your question is not valid. \$\endgroup\$ Jun 2, 2016 at 18:31
  • \$\begingroup\$ I need to read a dry contact with analog input pin, the reason for using the analog pin instead of a digital one is that is more convenient for the PCB layout to add a screw pin terminal near that input pin. I need a pull-up as I am reading a dry contact and so I would like to avoid floating readings. This is the reason I am asking if exists an internal pull-up to analog inputs. I know that would be better to use a digital pin, but the PCB is produced and I need to find an alternative. I hope that now the problem is clear. Thanks \$\endgroup\$
    – piertoni
    Jul 21, 2016 at 10:14

4 Answers 4

2
\$\begingroup\$

A pull up makes no sense on an analog input.

The Atmega 2560 datasheet ADC section(page 268) makes no mention of pull ups on the analog inputs.

The digital section (page 67) shows the switchable pull ups.

\$\endgroup\$
2
\$\begingroup\$

If you use the pin as a digital input, you can enable the internal pull-up resistor for that pin.

This is true regardless of whether the same pin also has the ability to be used as an analog input.

\$\endgroup\$
2
\$\begingroup\$

The internal pull-up resistors on analog inputs are mentioned in a tutorial:

https://www.arduino.cc/en/Tutorial/AnalogInputPins

The following tutorials use this in their sketches:

http://www.edisondev.net/Arduino/ArduinoAnalogPullup http://tronixstuff.com/2011/01/11/tutorial-using-analog-input-for-multiple-buttons/

\$\endgroup\$
1
\$\begingroup\$

Typically "pull-up" is a function used for binary inputs (either high or low). It is not clear why one would even need "pull-up" in an an analog input? If you did need some sort of pull-up, it would be arranged externally since there is no way of offering a pull-up internally that would be appropriate for all analog sources.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.