### You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » MCU digital input pins

 April 15, 2010 by CyberGod I learned that using the ADC pins as inputs we can obtain a wide range of voltage values and convert them to digital values. My question is how does the digital inputs work do we just get +5V and that's it? Just two values ? Or am I missing something? Also how fast can we read values from the digital inputs ? When you read a digital input, you get back a bit, either 0 or 1. 0 means that the pin is at nearly the same voltage potential as GND (near 0V). 1 means that the pin is at nearly the same voltage potential as VCC (near 5V if VCC is 5V). If the voltage is somewhere in the middle, like 2.5V, you'll still get either a 0 or a 1 (because those are the only options) but which one you get is undefined. And electrically it's a condition you want to avoid because it will cause a relatively large current flow and waste some power. The Atmega168 datasheet defines below 0.3VCC (1.5V) as a 0, and above 0.6VCC (3V) as a 1, and anything in between is undefined (you could get either a 0 or a 1). How fast can you read values? As fast as the CPU can go. There's no waiting like with the ADC converter. In fact, you usually read 8 inputs in one clock cycle because the value of a PINx register contains 8 bits. Thank you bretm this is exactly what I wanted to know !