Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Detect Tristate/Floating

Status
Not open for further replies.

Marks256

New Member
How would one detect if a line is tristate or floating without a status line?

One can easily tell if a line is high or low, simply by reading it, but what if the line is in tristate? What about floating?

One technique i was thinking of was connecting an io pin to the line in series with a resistor, and apply a voltage. If the line changes with the input, then it is tristate/floating. if the line does not change, then it is being held in a state. So basically a configurable pull up/down resistor. Would this work? I don't see why it wouldn't, however i really don't see it being the "right" way to do things :)


Thanks for the help!
-Dusty
 

crutschow

Well-Known Member
Most Helpful Member
Place two large (say 100K ohm) resistors in series between the +5V and ground. Connect the junction of the resistors to the tri-state output. If the output is in the tri-state mode, then the output will be about +2.5V. Otherwise the output will be high or low depending upon its output logic level.
 

blueroomelectronics

Well-Known Member
This app note shows how it's done mostly in software. Excellent article and could apply to any microcontroller.
**broken link removed**
8641-Engineer%27s_Assistant.gif

https://en.wikipedia.org/wiki/Voja_Antonić
 
Last edited:

Marks256

New Member
blueroomelectronics said:
That's one way. It's normally done with a window comparator. Check out logic probe schematics.

Thanks! I'll check out the window comparator.

crutscrow said:
Place two large (say 100K ohm) resistors in series between the +5V and ground. Connect the junction of the resistors to the tri-state output. If the output is in the tri-state mode, then the output will be about +2.5V. Otherwise the output will be high or low depending upon its output logic level.

As the day progressed i began to wonder about this technique as well. I think this will be the first thing i will try, If it works i'm going to have to find a way to easily read 28 analog inputs :)
 

eblc1388

Active Member
One technique i was thinking of was connecting an io pin to the line in series with a resistor, and apply a voltage. If the line changes with the input, then it is tristate/floating. if the line does not change, then it is being held in a state.

You are nearly there. You just need to add an extra capacitor of about 47pF to ground at the junction of the resistor and the line to be detected.

What you do is to see if the capacitor can "keep the voltage" you have assigned to it. If it does, the line is floating. If it doesn't, the line is not floating.

You do it like this. The I/O pin is in input mode to start with.

1. If you read the pin as logic LOW, change I/O pin mode into output and applies a HIGH. Wait a few instruction cycles.

2. Change the pin mode back into input and READ the logic state. If it is HIGH, the line is floating.

3. If read level in (1) above is HIGH, change pin mode into output and apply a LOW. Wait a few instruction cycles.

4. Change back into input mode and read the logic level. If it is LOW, the line is floating.
 

Mikebits

Well-Known Member
Would you mind sharing why you want to do this? Your software should know its state so I am am confused, is this off board?
 

3v0

Coop Build Coordinator
Forum Supporter
8 bit wide logic probe

A while back I made a 8bit wide 2x5 to 1x10 for connecting a ribbon cable from a target board to a solderless BB. It has red and green LEDs to tell the state of the line. The LEDs were driven by a 74HC245 so as not to load the line.

I want to build one that would indicated a floating line. Eric has told us how.

3v0
 

BrownOut

Banned
Place two large (say 100K ohm) resistors in series between the +5V and ground. Connect the junction of the resistors to the tri-state output. If the output is in the tri-state mode, then the output will be about +2.5V. Otherwise the output will be high or low depending upon its output logic level.

That's the way the million dollar commercial memory tester does it.
 

Marks256

New Member
You are nearly there. You just need to add an extra capacitor of about 47pF to ground at the junction of the resistor and the line to be detected.

What you do is to see if the capacitor can "keep the voltage" you have assigned to it. If it does, the line is floating. If it doesn't, the line is not floating.

You do it like this. The I/O pin is in input mode to start with.

1. If you read the pin as logic LOW, change I/O pin mode into output and applies a HIGH. Wait a few instruction cycles.

2. Change the pin mode back into input and READ the logic state. If it is HIGH, the line is floating.

3. If read level in (1) above is HIGH, change pin mode into output and apply a LOW. Wait a few instruction cycles.

4. Change back into input mode and read the logic level. If it is LOW, the line is floating.

Oh that IS a good idea! However it will require more I/Os than i have

Would you mind sharing why you want to do this? Your software should know its state so I am am confused, is this off board?

Hmm. Well. I don't want to say too much, but i think 3v0's example (following quote) fairly sums up my reasoning;

A while back I made a 8bit wide 2x5 to 1x10 for connecting a ribbon cable from a target board to a solderless BB. It has red and green LEDs to tell the state of the line. The LEDs were driven by a 74HC245 so as not to load the line.

I want to build one that would indicated a floating line. Eric has told us how.

3v0

That's the way the million dollar commercial memory tester does it.

I think this is the technique i will use. I need to be able to read analogue anyway, so this technique will save on parts, and make the system much simpler.
 

3v0

Coop Build Coordinator
Forum Supporter
eblc1388 method only takes one processor digital IO pin.

You first do a read to see if the voltage under test is high or low.

If you read high output a low, if you read low output a high.

Wait.

Read again. If the value read is what you just wrote the pin is floating because you were able to change it.

3v0
 
Last edited:

Marks256

New Member
Confused. :confused:

I'm talking about a single I/O pin, both for output and input.

eblc1388 method only takes one processor digital IO pin.

You first do a read to see if the voltage under test is high or low.

If you read high output a low, if you read low output a high.

Wait.

Read again. If the value read is what you just wrote the pin is floating because you were able to change it.

3v0

Yeah! Sorry about that! :) I understand it now. I think this may be what i will do. But won't that capacitor distort the signal? Say if the input signal isn't a status line, it is a data line or something similar, and is changing very rapidly? Also, how fast would this method be? I need to be able to read these lines very fast. No slower than 2MHz.
 
Last edited:

3v0

Coop Build Coordinator
Forum Supporter
I have no idea of what the speed limitations are.

It would be logical that if you sample faster you use a smaller cap which will come to voltage faster but hold the line for a shorter time.

I expect you need a PCB to test it.

3v0
 

Marks256

New Member
Would there be some sort of formula or rule to figure out times?

If not it's not a big deal, i can always just experiment.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top