Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Pull High or Pull Low

(you are viewing a thread; or go back to list of threads)

Pull High or Pull Low (by Tim Buttars)
My question is similar to the last thread. But I wanted to varify. With PICMicro's does it matter if I pull-high or pull-low? Does it have to be specified in the software? Does the chip just reconize a differance in voltage? What about outputs can they be pulled-high and change to 0V?
Sat Jan 8 2011, 13:28:36
(no subject) (by Jonathan Westhues)
If you read the datasheet of a PIC (or any other digital IC), then it will specify the input logic thresholds for a high (Vih) and low (Vih) voltage.

Here, for example, I've reproduced p. 251 of the datasheet for the PIC16F887. When the supply voltage Vdd is between 4.5 V and 5.5 V, we see that on a TTL input, any voltage less than 0.8 V will be recognized as LOW, and any voltage greater than 2.0 V will be recognized as HIGH. So a voltage of 0.5 V, for example, is guaranteed to generate a logic LOW. A voltage of 2.7 V is guaranteed to generate a logic HIGH. A voltage of 1.3 V could go either way; they don't make a guarantee in either direction.

(Different pins have different types of input buffers; see the datasheet for which. But most of the pins have TTL-threshold input buffers. Note that the name "TTL" just means that the voltage thresholds are similar to those of old bipolar transistor-to-transistor logic families; the logic is of course still implemented with CMOS field-effect transistors. So the input impedance of the pin is very large, many megohms, and it does not appreciably load the input in most cases.)

The software doesn't care how the voltage gets applied on the inputs; it just sees a 1 if the voltage is greater than Vih, and a 0 if it's less than Vil.

If an output is driven high and shorted to ground, then the output will indeed go to ground, assuming that the impedance of the short to ground is less than the output impedance of the pin. (A mechanical switch is probably less than an ohm, and the output impedance of the pin is probably around 30 ohms, so this will typically be the case.) But that's a bad idea, because a very large current will be flowing; it's the same as if you short-circuited your power supply to turn it off, instead of just disconnecting it. Most digital outputs are rated for a brief short to the opposite supply rail, but it's not a good idea to do so for more than a few milliseconds.
Sat Jan 8 2011, 15:15:29, download attachment table.png
(no subject) (by Peter)
Ok!
Inputs on PIC to be activated You have to give +5V and You put Pull Down (1k to 10k) resistor to avoid false triggering (POSITIVE LOGIC).
Inputs on ATMega128 are internally Pulled UP??? why I don't understand and they are hold active (ON) to deactivate input you have to externally give 0V (GND)(NEGATIVE LOGIC).
As Jonathan suggested best way is on ATMega to connect PULL DOWN resistor which is going to hold input deactivated and to apply +5V to activate input which value for resistor I don't know I will test it tomorrow.
I tested with inverter 7414 on input and it works excellent I have 0V and 5V signal (POSITIVE LOGIC).
Outputs are same when is ON You have +5V when is OFF-0V.
If You want I can make schematics for inputs.
Sat Jan 8 2011, 15:32:31
(no subject) (by Jonathan Westhues)
Some ICs, including the AVR micros, have internal pull-up resistors on some inputs. But they're weak (33k minimum, 122k maximum, for the ATmega128), so if you attach a 1k resistor to ground at the pin, then you get a voltage (with Vdd = 5 V) of (5 V)*(1k)/(33k + 1k) = 0.15 V, which is much less than Vil. So the pull-down holds the pin LOW. If you then close the switch to Vdd, that pulls the pin to approximately 5 V, which is HIGH.

It's better not rely upon the on-chip pull-ups, since they are so weak. You might have noise problems, or the current through the switch might not be enough to clean the contacts, which might make the switch become unreliable. (Most switches have both a minimum and maximum current specification.)

It's needlessly complicated to wire up an additional IC (and an obsolete one at that), instead of just marking the input as negated in software, or wiring the switch to Vdd with a pull-down instead of ground with a pull-up. I wouldn't advise anyone to do that.
Sat Jan 8 2011, 16:24:50
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):