tri-state input

Discussion in 'Electronics Resources' started by eminthepooh, Jun 17, 2013.

  1. eminthepooh

    Thread Starter New Member

    Aug 26, 2012
    27
    0
    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.


    Thanks,
     
  2. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Your Z value on an input is called a floating input, and is generally regarded as a bad thing...

    Why exactly would you want a non-deterministic circuit?
     
  3. eminthepooh

    Thread Starter New Member

    Aug 26, 2012
    27
    0
    It's to conserve resources (and it's a challenge at work to come up with a cool design)

    the truth table would be input A, output C and D
    A C D
    Z 0 0
    1 0 1
    0 1 0
    - 1 1

    and based on the input either C or D would command the system into 1 of 2 states.

    I'm guessing there's some game to play based on MOSFET threshold voltages.
     
  4. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    So, Z is an undefined voltage between Vss and Vdd? If so, how could you differentiate this from a 0 or 1 input?

    What is the difference between your "-" input and your "Z" input?
     
  5. eminthepooh

    Thread Starter New Member

    Aug 26, 2012
    27
    0
    I'm thinking a floating value can't souce/sink a sustained current but a held value of high or low can. So something along those lines.

    Not sure yet
     
  6. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    If you're talking CMOS, or otherwise using MOSFETs, what current is there to supply? MOSFETs are voltage controlled devices...
     
  7. eminthepooh

    Thread Starter New Member

    Aug 26, 2012
    27
    0
    Using resistors to change the voltages I think.
     
  8. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    ...and it's safe to assume these will be used in a voltage-dividing manner?
     
  9. eminthepooh

    Thread Starter New Member

    Aug 26, 2012
    27
    0
    yup. Every avenue I go down though I seem to need a validation of some sort. Now since I don't have a separate chip select or enable line I'm working on conditioning the input to provide that enable.
     
  10. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    ...doesn't that act as a pull-down when the input (to the "device") is floating?
     
  11. eminthepooh

    Thread Starter New Member

    Aug 26, 2012
    27
    0
    still working out the kinks haha
     
  12. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    I would suggest you define what it is you want to accomplish with this device, then attempt to implement that.

    A single inverter can implement your truth table, save for the "Z" and "-" inputs and could be fully implemented with another input..
     
  13. eminthepooh

    Thread Starter New Member

    Aug 26, 2012
    27
    0
    Yeah i know, this is more of a research into innovating with as few resources as possible.
     
  14. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    ...You need a direction to innovate in!
     
  15. eminthepooh

    Thread Starter New Member

    Aug 26, 2012
    27
    0
    Fair enough. I'll let you know how far I get with my crazy ideas :rolleyes:
     
  16. WBahn

    Moderator

    Mar 31, 2012
    17,788
    4,808
    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.
     
  17. panic mode

    Senior Member

    Oct 10, 2011
    1,321
    304
    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
     
  18. WBahn

    Moderator

    Mar 31, 2012
    17,788
    4,808
    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.
     
  19. panic mode

    Senior Member

    Oct 10, 2011
    1,321
    304
    this can be implemented in pure hardware too, no MCUs required.
     
Loading...