On Tue, 2005-08-09 at 10:07 -0400, wbounce wrote: > Read the data sheet for your part > But this is my understanding. > -----Original Message----- > Can any one give a sample code for > reading the value of a i/o PIN. Also tell > me role of pull up resistor in doiing so. \ As wbounce wrote, read the data sheet. As for the role of the pullup resistors: Pullup resistors lock the value of the input pin to a known value (Vcc, or logic 0 in this case). This is to insure that a pin connected to a tri-stated output from another chip doesn't read a false logic 1 because the tri-state voltage is above .5 Vcc. It is essentially a safety/reliability issue. When you pull the pulled-up pin low, the Vcc drops across the pullup resisotr, but allows the voltage at the pin itself to drop to ground (very nearly 0 V). Because the pullup resisots are integrated into the AVR chip, you don't need to worry about values. In general, pullup resistors want to be between 4.7K amd 15K ohms. This is to minimize the current drawn through the pullup resisotor, which current otherwise represents wasted energy and added heat (a very serious issue for portable, low-power electronics). Typically, larger values of pullup resistors have been found to lead to problems with stray RF pickup causing erroneous signals at the input pins, so they are to be avoided. Smaller values result in excessive heat geenration and power dissipation. When using discrete, external pullup resistors, the resistors should be mounted as close to the chiup package as possible, with the shortest traces possible between the pullup resistor and the package pin. Again, this is to avoid RF and other EMI interfereing with the correct operation of the circuit. tom
Message
RE: [AVR-Chat] help/reading I/0 pins
2005-08-09 by Thomas Keller
Attachments
- No local attachments were found for this message.