3

I was wondering if it was at all possible to detect a high-impedance state. I intend to use it with a LS245 within a register. It should essentially be able to turn on an LED (bring the output to HIGH).

Here is the schematic I have so far of the register with the LS245 chip (pretend VCC and GND are connected, the LS173 chips are just D flip-flops):

Register Schematic

To clarify, I want to take an output of the LS245 chip, and with only that as an input, determine whether it is HIGH, LOW, or high-impedance.

Edit: I was thinking I could do something with the current leakage from a transistor, but I'm pretty inexperienced and don't really know how I could make that work. My input voltage will be 5 V, and I have experienced some current leakage from these transistors before, but I don't understand how I can use this behavior to my advantage.

Edit 2: The pins states should be only HIGH (5 V), LOW (GND), and high-impedance. I just intend to use this circuit to turn on and off an LED, nothing more. The transistor idea is probably ineffective, but when making the circuit shown below the LED would shine, albeit dimly, but current still would flow. I don't know if leakage is the correct term for this phenomenon, but I think it could be used to detect a High impedance state

Schematic

ocrdu
  • 8,705
  • 21
  • 30
  • 42
Aiden K
  • 39
  • 3
  • 1
    Do you have any constraints? What are the different possible states of that pin? What do you want to differentiate it with (open drive, open collector, push pull, etc)? Can you support interference on that pin? – Julien Jul 26 '23 at 15:21
  • 1
    What leakage are you talking about? Of my head, I don't have an idea on how a transistor could measure the impedance, but please, follow through on your idea! – Julien Jul 26 '23 at 15:56
  • 1
    Aiden K - Hi, (a) From your question, I don't have a clear idea of the context (for me "*LS245 within a register*" is unclear). To make things easier for readers, I recommend you add more context & a schematic, either a photo of a clear drawing (use Ctrl+G / "mountains" icon in the edit box) or using the built-in schematic editor (use Ctrl+M / "schematic" icon in the edit box - not supported on touch devices). (b) These previous topics might include suitable answers - please say so if one is, or add more info to your question to explain why they aren't: [Q1](/q/164493) and [Q2](/q/460577). – SamGibson Jul 26 '23 at 16:10
  • Are you just trying to find the state of the '245 outputs or the state of the bus lines? – GodJihyo Jul 26 '23 at 16:34
  • @GodJihyo Just the state of the 245 outputs, but should be able to be used on a bus line – Aiden K Jul 26 '23 at 19:44
  • 1
    @AidenK If you just want to know if the '245 outputs are high impedance you could buffer /OE and use that to drive an LED. If /OE is high all the outputs are high impedance, if it's low none are, it's all or none. If you try to sense the outputs directly any other device on the bus will affect it. Maybe it would help if you tell us exactly why you want to do this. – GodJihyo Jul 26 '23 at 19:58
  • I might be (a lot) more straightforward to combine the output enables of everything driving the bus into one signal. That is to say, if none of the output enables are asserted then you can infer the bus is in tristate. – td127 Jul 26 '23 at 20:17

3 Answers3

5

One way to do it is to place a pull-up and pull-down resistors on your pin. If the voltage is close to VCC/2, you are in high impedance mode. But I don’t have enough info to know whether or not this can suit your design.

Edit: to "measure"/compare the voltage, many techniques can be used. The simplest one would be to use 2 comparators: 1 comparing if the signal is higher then vcc/3 and the other if the signal is lower then 2*vcc/3 (for example, could be other ratios). Then you pass it into an AND gate. Of course, this circuit isn't the most optimized but it's simple to visualize. To reduce your BOM, you can invert one of the comparator (ie. Measure if signal is lower vcc/3). This allows to plug the led directly between the 2 comparators without logic gate. If price is a concern, the transistor circuit is a viable option (will most likely rake more space). Hope it clarity!

Julien
  • 1,717
  • 14
  • How is that able to detect high impedace from high or low? – Justme Jul 26 '23 at 16:11
  • @Justme high impedance turns into halfway between high and low – user253751 Jul 26 '23 at 17:03
  • 1
    Right, but *how* is that detected? – rdtsc Jul 26 '23 at 17:03
  • 4
    A window comparator. Set it so anything between maximum low and minimum high voltages for whatever logic family you're using will give an output to light the LED, choose pull-up/pull-down values for the center of that range with high impedance from '245. OP's update makes it sound like they want to detect high and low as well but that's also possible with window detector, one output will be high for high input, the other for low, a NOR of the outputs will be high for high impedance input. – GodJihyo Jul 26 '23 at 17:16
  • @Justme High-impedance is just another term for a logically open circuit. If the pin is OPEN (high impedance), the pin doesn't conduct any current into whatever port it's connected to and so the pull-up and pull-down resistors (assuming equal) simply divide the voltage between them as if it's a simple VCC-R1-R2-GND. – micropyre Jul 27 '23 at 07:09
  • @micropyre I am not asking what high impedance means. I am asking how this anwer is any helpful drawing an actual circuit that can give out information if the circuit is in high impedace mode. Of course you can use a multimeter to see if wire is at 0V, 5V, or 2.5V, but the answer does not say how such a circuit to detect it would look like. Can you draw such a circuit that detects high impedance, *how* it will detect it? – Justme Jul 27 '23 at 08:11
5

Basic idea

The difficulty of implementing this circuit solution comes from the fact that things are reversed - the LED should light up when there is no voltage and no current flows. This problem can be solved with a clever trick - the LED lights up in the high impedance state and turns off in the other two states by connecting another diode with a lower forward voltage in parallel.

Version 1

The LED HI indicating the high impedance state is "stretched" through the "pulling up" (R2) and "pulling down" (R3) resistors between the supply rails. The transistors Q1 and Q2 act as transistor switches that can connect one of the diodes (D1 or D2) in parallel to the LED to switch it off.

High-impedance indicator

Low input voltage: Q2 turns on and connects D2 (0.7 V) in parallel to HI LED (1.8 V). So all the current is diverted (steered) from HI to D2.

schematic

simulate this circuit – Schematic created using CircuitLab

High impedance: Both Q1 and Q2 are off so all the current flows through the HI LED.

schematic

simulate this circuit

High input voltage: Now Q1 turns on and connects D1 (0.7 V) in parallel to HI LED (1.8 V). So all the current is diverted (steered) from HI to D1.

schematic

simulate this circuit

Analog comparator

The circuit works analogously to the above, except that instead of a high impedance state, an input voltage Vin = Vcc/2 is applied.

schematic

simulate this circuit

So, in the middle region, the voltage across the LED changes from 0.7 V to 1.8 V ...

STEP 1.2a

... and the current is maximum.

STEP 1.2b

3-state digital indicator

If we replace the Si diodes with LEDs, all the three states will be indicated. HI LED must have higher forward voltage than LOW and HIGH LEDs. It can be the same as them if we connect an Si diode in series (0.7 V is added).

Low input voltage: Q2 turns on and connects LOW (1.8 V) in parallel to the string HI-D (1.8 V+ 0.7 V = 2.5 V). So all the current is diverted (steered) from the string to LOW.

schematic

simulate this circuit

High impedance: Both Q1 and Q2 are off so all the current flows through the HI LED.

schematic

simulate this circuit

High input voltage: Now Q1 turns on and connects HIGH (1.8 V) in parallel to the string HI-D (2.5 V). The current is diverted (steered) from the string to HIGH.

schematic

simulate this circuit

Analog indicator

schematic

simulate this circuit

STEP 1.4

Version 2

A more beautiful circuit solution can be obtained if we connect the transistors and diodes as shown below. Here the transistors not only turn on a diode in parallel with the LED but also short out the other diode.

3-state digital indicator

Low input voltage: Q2 turns on, shunts HIGH LED and connects LOW (1.8 V) in parallel to the string HI-D (1.8 V+ 0.7 V = 2.5 V). So all the current is diverted (steered) from the string to LOW.

schematic

simulate this circuit

High impedance: Both Q1 and Q2 are off. The HIGH and LOW LEDs meet the requirement that the sum of their voltages is higher than the total voltage of the HI-D diode string. As a result, all the current flows through the HI LED.

schematic

simulate this circuit

High input voltage: Now Q1 turns on, shunts LOW LED and connects HIGH (1.8 V) in parallel to the string HI-D (2.5 V). The current is diverted (steered) from the string to HIGH.

schematic

simulate this circuit

Analog indicator

The circuit works analogously to the above, except that instead of a high impedance state, an input voltage Vin = Vcc/2 is applied. Both Q1 and Q2 are off and all the current flows through the MID LED.

schematic

simulate this circuit

STEP 1.2a

Version 3

schematic

simulate this circuit

STEP 3

See more in my Codidact paper 3-LED voltage indicator (an inventor's story).

Circuit fantasist
  • 13,593
  • 1
  • 17
  • 48
5

One issue you have already is attempting to drive HC devices with 'LS outputs. Won't work: the 'LS output-high voltage won't meet the HC input high threshold. So there's that.

Beyond this issue, an old debugging trick to test whether a bus is truly 3-stated or not is to drive it weakly with pulses (e.g., an HC245 with a series resistor, like 10k) then check to see if the bus signal follows the weak drive or not. If it doesn't, something else is driving it strongly. If it does, then it's high-Z.

Note that you need to test both drive-high and drive-low cases.

Now, as for how 3-state buses are handled, it's never a good idea to leave them floating for long, especially with CMOS inputs. The signals should have some kind of termination to a valid logic level. Otherwise your inputs can float to a level that causes them to use too much power or oscillate.

hacktastical
  • 49,832
  • 2
  • 47
  • 138
  • The schematic I gave works as intended, all the chips are HC, I was just lazy with the schematic. The register works well, but I am trying to add a LEDs that are able to detect whether the value of each bit of the bus is Z, and turns off if it is HIGH or LOW. – Aiden K Jul 26 '23 at 19:39
  • 1
    @AidenK But LS chips work completely differently from HC chips, so any answer given which now assumes LS chips being used may not work with HC chips! Do not ecplicitly say you use different chips than what you actually use. – Justme Jul 26 '23 at 20:06
  • 2
    And "lazy" schematics are never a good idea. Having to read paragraphs of text to understand a schematic defeats its purpose. The schematic is there to convey all of the needed information, correctly, clearly, and succinctly. Many here will skip over incomplete schematics because they don't have the time or patience to read the omitted content and try to decipher what the schematic should be showing. If you want the best answers, make doubly-sure the schematic is perfect, even for tiny circuits. – rdtsc Jul 26 '23 at 20:19