Maker Pro
Maker Pro

Pins with pullup resistors built in

bigone5500

Apr 9, 2014
712
Joined
Apr 9, 2014
Messages
712
On the 328P-PU, do all digital and analog pins have pullup resistors built in? If not, which pins do have them?
 

dorke

Jun 20, 2015
2,342
Joined
Jun 20, 2015
Messages
2,342
The answer to your question is "hidden" on the AVR datasheet on chapter 14 (page 75).

Why on earth do you think an analog input should have a pullup resistor?o_O
 

bigone5500

Apr 9, 2014
712
Joined
Apr 9, 2014
Messages
712
The answer to your question is "hidden" on the AVR datasheet on chapter 14 (page 75).

Why on earth do you think an analog input should have a pullup resistor?o_O
Because I am new to this???

And I have looked at the datasheet on the chip. Didn't really know what I was looking at, hence this question.

Thanks though.
 

dorke

Jun 20, 2015
2,342
Joined
Jun 20, 2015
Messages
2,342
O.K
The term pull-up(down) resistor is a term coined in the digital world.

It is related to the inputs of digital circuits-in which we would want to decide the input logic state of an un-used input as well as a default logic state for a used input(weak pull).

It is also related to the outputs of digital circuits in devices(sometimes used for wired-or/and) which have open-collector(drain),open-emitter(source),
as well as devices with Tri-State ,the state the output isn't driven(buses etc.)

The term pull-up(down) resistor is meaningless in the analog circuit world.

Hope this helps clarify things;)
 

bigone5500

Apr 9, 2014
712
Joined
Apr 9, 2014
Messages
712
X-IV!

I did follow the link above and carefully read through a couple pages on the digital pins. I finally saw what you referenced.

Thanks!!
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
In the PIC environment, making a pin an analog input disables the input buffer, so the setting of a weak pull-up is mooted.

However, it appears that atmel don't follow the same strategy because there is a warning that setting weak pull-up on a pin set for analog input will affect the values reported by analogread.

I would recommend a deep read of the datasheet(s). I have read the datasheet again, and while I can see that the pull-up can be functional on an analog input pin, I didn't find the warning. However I did find people using this feature to read light levels using an LDR (where the weak pull-up forms the upper part of a voltage divider).

Note that this doesn't detract from anything @dorke has said. However, it also doesn't mean that you can't think up a situation in which this pull-up could be used for some purpose in conjunction with analogread.
 
Top