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.

Passerby
73.9k7 gold badges97 silver badges214 bronze badges
asked Jun 2, 2016 at 12:25
\$\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\$ Commented 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\$ Commented 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\$ Commented 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.

answered Jun 2, 2016 at 13:01
\$\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.

answered Jun 2, 2016 at 14:16
\$\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/

answered Jan 18, 2017 at 6:18
\$\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.

answered Jun 2, 2016 at 12:40
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.