-2

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?

Green Falcon
  • 107
  • 5
  • 2
    A resistor connected to GND? – NicolaSysnet May 26 '16 at 10:53
  • @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 – Green Falcon May 26 '16 at 11:04
  • @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! – SamGibson May 26 '16 at 11:24
  • @SamGibson I needed something like truth table – Green Falcon May 26 '16 at 11:30
  • @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! – SamGibson May 26 '16 at 11:33
  • @media - based on your newly added diagram - (a) Why do you believe that the output of U4 OR gate can ever be "Z" (high impedance)? (b) What part number is your U4? – SamGibson May 26 '16 at 11:40
  • Well... from the picture you attached I suppose you have a simulator. To make it work you can replace the open collector OR gate with a push-pull one, or you can simply find a component that act as a pull-down, normally you have it in a simulator. – NicolaSysnet May 26 '16 at 11:41
  • @SamGibson a) the output of OR gate can be 1 whenever a button from keypad is pressed otherwise the output of OR gate is a value which is not zero or one, so I guess it's z. – Green Falcon May 26 '16 at 11:55
  • @media - "otherwise the output of OR gate is a value which is not zero or one, so I guess it's z" - Your "guess" can be *wrong*, depending on the answer which you didn't give, to my previous question (b). :-( If you don't answer questions, people can't help you :-( – SamGibson May 26 '16 at 11:58
  • @SamGibson actually I do not know its part number but its just like binary or. And about being not sure, I am sure. – Green Falcon May 26 '16 at 12:03
  • @media - "I do not know its part number" - In that case, you need to find out either its part number or its *exact* characteristics. You will benefit from learning more about the different type of logic gate outputs, so that you will learn why your previous "guess" can (often) be wrong. "And about being not sure, I am sure." - Sorry, that makes no sense to me. As Olin said, I think there are too many misconceptions for it to be sensible for me to try to help any more. If you are lucky, you might find someone else with more time, to continue explaining. Good luck! – SamGibson May 26 '16 at 12:17

2 Answers2

2

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.

Olin Lathrop
  • 310,974
  • 36
  • 428
  • 915
  • 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. – Jan Lucas May 26 '16 at 11:11
  • @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. – Olin Lathrop May 26 '16 at 11:14
  • @OlinLathrop actually I did not get it. can you tell me the truth table or something that I can make a circuit from. thanks – Green Falcon May 26 '16 at 11:25
1

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.

Jan Lucas
  • 321
  • 1
  • 5