Hi,
I know about pull ups and pull downs, but i'm trying to see if there is a real way to reliably have all three 0,1, and Z values on an input. I can't use pull ups and pull downs since they eliminate the Z value. I want to either give a command of 0 or 1 to an input, if I haven't commanded anything, it shouldn't register any input. And of course for maximum fun this is all done using 1 line.

This is an input to what? A standard chip of some kind, are a chip that you are designing?

What you are trying to do is to process a multi-level signal as opposed to a binary-level signal, though in your case you are adding the complication that one of the levels is a high-impedance output instead of a defined voltage level.

But that's fairly easy to accommodate.

Take your single input and buffer it with two voltage followers. The apply the outputs of the followers to two inverters, one of which has a pull-down and the other of which has a pull-up. Call the output of the first one X and the output of the second one Y. Your truth table is therefore:

A

X

Y

0

1

1

1

0

0

Z

1

0

If you ever saw XY=01, that would indicate a likely failure of some part of the circuit.

Note that you need the buffers to allow the inputs of the two inverters to be at different levels.

put some tiny capacitor across input, then in your code:
- change input to output,
- set it low
- change back to input,
- wait a bit
- check if it is low.
- change input to output,
- set it high
- change back to input,
- wait a bit
- check if it is high.

if both checks match the state you assigned while pin was configured as output, then you have Z

put some tiny capacitor across input, then in your code:
- change input to output,
- set it low
- change back to input,
- wait a bit
- check if it is low.
- change input to output,
- set it high
- change back to input,
- wait a bit
- check if it is high.

if both checks match the state you assigned while pin was configured as output, then you have Z

Click to expand...

This is IF the OP's input is on a programmable part.

Also, they need to be careful that they don't mess something up in whatever is providing the output signal. It probably would not be physically damaged by the short-lived contention, but it might upset the state of the output pin or it might upset the state that the device thinks it is outputting. For instance, if it is a part that writes data to the port and then relies on reading the actual state of the output pin in order to infer the value stored as the output data in the register.