Electronic – Bus value if some pins are floating

busdigital-logicfloating-pin

I'm working on plugin for simulation software (digital IC only).
For example there is 8 bit bus.
User wants to read it's value. On plugin side I check each pin's state. It can be 1, 0 or undefined. At the moment if at least one bit is floating, I return nil as bus value. Is it right at all? May be better return value replacing floating bits with random [1-0] and warn user in log about it?

Best Answer

I'm sorry, but you're out of luck. There is no obvious way to tell if a digital input is floating. The bus receivers cannot tell if a given input voltage level is occurring because a driver wanted to, or if it's because there is no input driver. All it knows is that the input is either higher (logic 1) or lower (logic 0) than the receiver's threshold voltage.

It's certainly possible to build such a circuit:

schematic

simulate this circuit – Schematic created using CircuitLab

In this case, Vth is the nominal logic threshold voltage, and R4 is a largish resistance. R1/R2/R3 set the upper and lower error bounds for the input voltage.

In operation, a valid high or low on the input will pull it either above or below the comparator set points, and both comparators will read either high or low. This sets the XOR output low, indicating that the output is good. If the input is left floating, R4 pulls the input to an intermediate value, and one comparator goes high while the other goes low, and the XOR output is driven high, indicating a floating input.

Needless to say, I doubt very much that your digital inputs look like this.