Since inputs to logic gates a susceptible to noise which could cause a voltage on the inputs Are pull up and pull down resistors always used in logic gates?
Are pull up and pull down resistors always used in logic gates?
If you would add a pull-up/down standard on any gate the power consumption would go up and the speed would go down. Also following you reasoning two connect gates would have two pull-ups or pull-downs or even worse a pull-up and a pull-down.
pull-ups/pull-downs are used only for special cases. The most common are:
To tie-off unused inputs
On open collector/open drain outputs (See I2C or shared interrupt lines)
Inputs to logic, especially CMOS shouldn't be left floating, so yes, they should either be driven or have a pull up/down.
Pull up and pull down resistors are mainly used because the driving capacity of a logic gate or any digital device maybe low. The output current is in milliamps which cannot be used to drive any kind of load if connected. Also due to difference in the input and output levels of different type of logic gates for recognizing a particular level as logic 1 or 0 these pull up and pull down resistors are necessary to drive the voltage up or down and create a proper interfacing
You use a pullup/pulldown resistor if there is a state that leaves the input signal undefined. Output from most logic gates is "totem pole" (push-pull) so the output signal is always defined; no conditioning is required to feed the signal into another gate.
Pullups are most commonly used when you have an external circuit that connects to ground, such as a pushbutton, switch, etc. With the circuit open, there is no defined value on the input pin, so you add a pullup to give it a defined value. This is such a common technique that many MCU chips have an "input pullup" option on input pins (e.g., Atmel/Microchip AVR pinMode(pin, INPUT_PULLUP); ) A pulldown resistor is used when the external signal is asserted high but has no defined value when not asserted, so the pulldown gives the pin a defined value (GND) when the input signal is absent. Pulldown is less frequently used.
Pullups are also used if the input signal is from circuits like an open-collector or open-drain circuit, which has no defined value if the drive transistor is not conducting. These are most commonly used when driving a bus, such as I2C, SPI or 1-wire. A totem-pole driver on such a shared line would mean that the line was being actively pulled up by some number of gates while another gate was trying to pull it low. This means that the sink current of the pulldown transistor would be exceeded, and it would act more like a fuse than a transistor. Open-drain means that the line is high since it is pulled up by a resistor, and whichever transistor is driving it pulls it low (ideally, only one transistor is transmitting a signal at aa time). It is also used when you want to feed several interrupt-generating devices into a single INT pin; the INT signals are usually done with open-drain, so any time the signal is low, an interrupt condition is considered present. It is up to you to figure out what device interrupted and causing it to reset and release the line driver. The setting for the pin is interrupt-on-low (level interrupt, not edge interrupt), so if any other device is asserting interrupt, when you return from your interrupt handler and re-enable interrupts, an interrupt is immediately taken. Sort out what interrupted, clear the interrupt, repeat as required. (This is how PCI interrupts work).