Atmega8 input impedance

What is the Atmega8 input impedance. I want to add a push button to an Atmega8 and my configuration would look something like this:

A +5V source, resistor, push button not pressed goes to Atmega8, pushed goes to ground.

From my understanding Atmega8 is a CMOS and therefor the input impedance would be very large, most likely in the 100MOhm. For a logical high the Amtega8 need 0.6Vcc, my Vcc is 5V, therefore a high will be considered for anything above 3V. Assuming that my assumption of very high input impedance is right, the resistor can be:

3V = 5*100M/(100M+R) ==>R = (500-300)/3 = 66.66MOhm.

Would that be the correct theoretical highest resistor value that I can use?

**The actual resistor used will be a 47kOhm but I really want to know how to find the maximum theoretical value.

Look in the datasheet and find the pin leakage current. CMOS digital inputs are usually specified as having a maximum leakage current as apposed to a minimum resistance. Now look at the minimum guaranteed logic high input voltage at your operating conditions. The supply voltage minus the minimum high voltage tells you the maximum voltage the pullup can drop and the input to still be interpreted as high. That drop voltage divided by the total leakage current is the maximum theoretical allowed pullup resistor.

Note that I said "total" leakage current. This is not only the pin input leakage but leakage from all other sources, like other pins of other devices connected to that node, whatever you think the leakage is accross the PC board at the worst case level of dirt and humidity, etc. In practise you can't know all these things. Do all the calculations you want, but I'd want a pullup at least a order of magnitude lower resistance than the maximum theoretical you calculate. When current consumption matters, I usually figure 100 kΩ is the maximum safe and reliable value. When it doesn't, I'll use 10 kΩ unless there is a good reason not to.

What Olin says !

Rules of thumb, on a CMOS input with minimal tracks away from the pin.

• 10 megohms will usually work. Don't be surprised if it doesn't. Conformal coating and/or nice environment would usually make this "almost safe".

• 1 megohm. Almost always safe as long as there is no contamination. Higher than you'd use with comfort.

• 100 k.ohm. "Always"* safe as long as there is no contamination, no extra circuitry etc. If this does not work then there is something unexpected or non odeal happening. Murphy is good at these.

• 10 KOhm. 0.5 mA at 5V. Really shouldn't need to go that low. If this is essential then something bad is happening. Given that bad things do in fact happen this is not a terrible idea in many cases.

• 1 k ohm. 5 mA at 5V!!! This is more than some pins can drive. Is it underwater? BUT this is nothing for a pushbutton etc. Long wiring runs, possibility of contamination, adverse environment may make this a good idea. OK for pushbutton to drive. May not want processor driving this. Wasteful of power if switch is closed permanently rather than momentary action.If you need to go this low you may wish to look at a different design that deals with the problems better.

• Lower? Redesign it. Optocoupler? Capacitive coupling from ? Other ?