I have one input which its states can be 1 or z (high impedance) and the result should be 1 and 0 respectively. Can anyone design a logical function for this? thanks.
Edited Part: enter image description here

As you can see the output of the highlighted OR can be z or 1, I want to make 0 from z and 1 out of 1. how?

  • 2
    \$\begingroup\$ A resistor connected to GND? \$\endgroup\$ – NicolaSysnet May 26 '16 at 10:53
  • \$\begingroup\$ @NicolaSysnet I meant I have an input named a which can have logical values z or 1 I want to make a function that creates 0 out of z and 1 with input 1 \$\endgroup\$ – Media May 26 '16 at 11:04
  • \$\begingroup\$ @media - You seem to be rejecting a pulldown resistor as the solution. So what exactly do you mean by a "function" in your question? Based on your question, no "function" (as I understand it) is required, so must mean something else. How are you going to use whatever answer you get? e.g. a practical circuit? (in which case, supply the schematic), or in an academic test? (in which case, supply the whole question and some context). Please add your clarification to the end of the text in your question above, so readers don't have to search the comments to understand your question. Thanks! \$\endgroup\$ – SamGibson May 26 '16 at 11:24
  • \$\begingroup\$ @SamGibson I needed something like truth table \$\endgroup\$ – Media May 26 '16 at 11:30
  • \$\begingroup\$ @media - The truth table for a logic gate (e.g. buffer) with a suitable pulldown resistor on its input, is exactly as you requested in your question! \$\endgroup\$ – SamGibson May 26 '16 at 11:33

This can be easily accomplished with a pulldown resistor. That's a fancy name for a resistor to ground. The resistor value is set low enough so that the line is held solidly in the logic low state when nothing else is driving it. The value is high enough to not exceed the current source capability of anything that needs to drive the line high.

For example, let's say the line can be driven by a CMOS logic output that can source up to 4 mA in the high state. At 3.3 V, it takes (3.3 V)/(4 mA) = 825 Ω to draw 4 mA. That's the lowest allowed pulldown resistance. You could safely use 1 kΩ, for example.

There are more tradeoffs, so see this explanation of pullup resistors. Pullups are the same concept, except the line is held high when not driven instead of low.

Added in response to schematic

You are asking about a line that is either left high-z or actively driven high. However, that is very unlikely what is actually happening here. You show this line being driven by a OR gate. Those usually either drive actively in both directions, or sometimes drive actively low with high-z for the other state. Check the datasheet.

Asking for a "truth table" for this makes no sense.

These two confusions indicate that you have too many basic misconceptions and too little basic knowledge for a reasonable answer here to be possible. The best I can suggest is to give this project to someone that knows what they are doing. Perhaps you can learn a little from them.

  • \$\begingroup\$ Using 1 kΩ will waste quite a bit of power, usually larger resistor values such as 4.7kΩ or 10kΩ are used to conserve power. Larger resistor values reduces the power consumption but at the same time also reduce the speed. \$\endgroup\$ – Jan Lucas May 26 '16 at 11:11
  • \$\begingroup\$ @Jan: Right. As I said, there are more tradeoffs, which I go into detail on in the linked answer. There is no point duplicating all that information here. \$\endgroup\$ – Olin Lathrop May 26 '16 at 11:14
  • \$\begingroup\$ @OlinLathrop actually I did not get it. can you tell me the truth table or something that I can make a circuit from. thanks \$\endgroup\$ – Media May 26 '16 at 11:25

Your circuit looks a bit like a microcontroller connected to a keypad and the 4 or gates allow generating an interrupt if someone presses any key. Your OR gates outputs will likely only output 0 or 1 but never Z. You should be concerned about the inputs of the 2 OR gates on the left. To check if a key is pressed, you would drive that row input (A-D) to 1 and the other row inputs to Z. You configure the microcontroller pins as pull-down and read their status, if it 1 then the key is pressed, if it is 0 then the key is not pressed.

If you want to generate an interrupt, if any key is pressed you would drive A to D with 1 and configure the pins 1-4 as pulldown. As long as no key is pressed the output of your OR gate will be 0 and if any key is pressed the output of the OR gate would be 1 and if the MCU pin connected to the OR gate is a interrupt pin, you could use that to wake up from sleep. If it is not a interrupt pin the OR gates are not really needed and everything they do can easily be achieved using only software.


Not the answer you're looking for? Browse other questions tagged or ask your own question.