So on the Atmega328 datasheet there is a comment on the "Internal Pull-Up Resistor" being set to "on". It specifically says this:

Pxn will source current if ext. pulled low.

Maybe im just being really stupid....but what does this mean? I mean I understand what a Pull-Up does....but then it's talking about externally being pulled low? Im assuming this is saying that if the Pin is pulled up, it's connected to VCC (in some way, im probably wrong) but that if we connect the outside pin to GND that we'll have current flowing from VCC--->PIN--->Ext. Pull-down resistor---->GND.

A pin that 'sources' current causes current to flow from inside the chip to the outside world via the pin. It normally comes from the +ve rail.

A pin that 'sinks' current causes current to flow from the outside world into the chip via the pin. It normally flows to the 0v rail.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

So the internal and external resistors would form a voltage divider and that voltage would be input to the pin. If this voltage is neither >>HIGH<< nor >>LOW<<, you will have even more power consumption (besides the one flowing through the resistors) because CMOS transistors from the input buffer present in every pin will be in an intermediate state.

The pull-up is (effectively) a resistor to Vcc. Thus, when the pin is logic high, there is no effective pull-up because the pin is already as high as it will go. Pull-up only does something when the input is low. That is, the pull-up only sources current when the pin is low, and for low power situations, you need to take this current into account.

I actually ran into the same problem as Be_logic. Im assuming it's just floating, as moving the button around or repressing it would make the LED turn off. (Assuming it turns on when the Pin is pulled to ground via button push). Because if I straight up took the wire going to Pin whatever and touched it to ground then it always worked. Probably just a really floaty button I guess.

The first attempt was made with a standard Xplained Mini board with a switch and an SMD LED on the board, see http://ww1.microchip.com/downloa...
But if I use eg Port B0 as switch input from which I can switch a short wire to ground then it only works if I use an EXTERNAL pull resistor to Vcc from PB0.

then it only works if I use an EXTERNAL pull resistor to Vcc from PB0.

I find that VERY hard to believe. Please post the shortest complete test program that demonstrates the symptoms. Tell language/toolchain/version and build settings. Tell/show how you are testing.

I've done scores and scores of AVR8 production designs. Many/most use internal pullups for simple stuff like close-by control buttons and DIP switch blocks and switches and similar. The number of units in the field is close to or at seven figures. Many of the designs are with the discussed AVR family. If there was a floaty problem, I'd have been hearing about it, loud and clear.

(global PUD on?)

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

That board is a '328PB, right? I looked over the thread again; is that the first mention of PB?

Was your second attempt also with the PB?

theusch wrote:

Please post the shortest complete test program that demonstrates the symptoms.

[edit] Tell more about this "first attempt", and the results. The Xplained Mini hardware user guide indictes an active-low button on PB7, with an external pullup. Show the program that used that pin, andc tell the failing results.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

I'm getting confused. The Xplained Mini works -- or does not work? That board has a button on PB7. What is this about PB0? Is this your own board, and not the Xplained? Let's see the schematic, and a good picture of this button area.

As mentioned, buttons bounce. You can indeed get an odd number of ISR hits.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.