Author Topic: Dumb question about AVR pullups  (Read 2124 times)

0 Members and 1 Guest are viewing this topic.

Offline Dan MoosTopic starter

  • Frequent Contributor
  • **
  • Posts: 357
  • Country: us
Dumb question about AVR pullups
« on: February 27, 2017, 04:24:26 am »
So say I set a particular pin as an input, and, and activate that pin's internal pullup.

Is there anything bad that could happen if a HIGH signal is sent to that pin, such that it's getting 5 volts from two sources at once?

Related question. Let's say I don't enable the internal pullup. The MCU can still read the pin even if it's tri-stated, right?

App specific question. I'm gathering input with a 74HC165 shift register. I'm not confident how to properly set up the MCU pin that gets the serial output from the shift register. My gut says no internal pullup, but I'm not sure.


Sent from my E6830 using Tapatalk

 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: Dumb question about AVR pullups
« Reply #1 on: February 27, 2017, 04:37:52 am »
The voltage will still come from the same source - your power supply.

There is no harm having a pull-up, especially given that it is pretty weak. If connected device do drive the line, then there is no need for it, however.
Alex
 
The following users thanked this post: Dan Moos

Offline Dan MoosTopic starter

  • Frequent Contributor
  • **
  • Posts: 357
  • Country: us
Re: Dumb question about AVR pullups
« Reply #2 on: February 27, 2017, 04:42:42 am »
Ah, good way to put it. If I use the internal pullup, and my shift register sends it HIGH, its the equivalent of just using two parallel resisters from Vcc as a pullup, which is obviously harmless if you think about it that way.

Is there an accepted standard practice to this? In other words, are there pros and cons to using/not using the internal pullup?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: Dumb question about AVR pullups
« Reply #3 on: February 27, 2017, 04:45:31 am »
If your driving device always actively drives its output, then no pull-up is needed. 74HC165 has no way of making any of its outputs tri-state, so it can be used without a pull-up.
Alex
 

Offline Dan MoosTopic starter

  • Frequent Contributor
  • **
  • Posts: 357
  • Country: us
Re: Dumb question about AVR pullups
« Reply #4 on: February 27, 2017, 04:50:08 am »
Right on. Thanks as usual. I've just never thought about the consequences of using one or the other setting. All is clear now!
 

Offline bobaruni

  • Regular Contributor
  • *
  • Posts: 156
  • Country: au
Re: Dumb question about AVR pullups
« Reply #5 on: February 27, 2017, 05:55:05 am »
There is no harm in using a pull-up with an active device except that there will be slightly more current consumption when the active output is low, this should be avoided if you are trying to conserve battery power.
 
 

Offline MagicSmoker

  • Super Contributor
  • ***
  • Posts: 1408
  • Country: us
Re: Dumb question about AVR pullups
« Reply #6 on: February 27, 2017, 01:16:15 pm »
One other thing to keep in mind is that all I/O pins go Hi-Z (tri-state) during power on and reset; you can get into a lot of trouble with output pins, especially, if there isn't an external resistor to define their state.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Dumb question about AVR pullups
« Reply #7 on: February 27, 2017, 02:39:40 pm »
If you are using SPI slaves that can tristate MISO when deselected, then a pullup on that line would be a good idea so it isn't floating between data blocks.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf