Forum Updated! 

Main Menu

Bi-Directional Line

Started by atom, October 28, 2004, 07:48:30 AM

Previous topic - Next topic


I want to make a bi-directional data line for my own controller interface to reduce the number of pins my connector needs. Is there a simple way to do this?
forgive my broked english, for I am an AMERICAN


Yes, but you'll need some form of protocol between the two ends to ensure they don't both try to talk at the same time.

Probably the easiest way to do it is to have both ends use an open collector output, and put a pullup on the dataline at the "master" end. This way, the data line will float high due to the pullup, and the open collector outputs can pull the line low.  
[ Not an authoritive source of information. ]


Hmmmmmmmmmmmmm, I'm not going to pretend I fully understand what you said, but I have come up with an idea of what you are talking about.

The circuit basically would be

input ______          ______output
output_____|         |______input

The problem is that obviously one port's input would go straight into its output. In my protocol I have an unused bit, I could set it to be 1 for a console side signal and 0 for a controller side signal. That way the port could tell if its getting its own signal and ignore it. Timing is already set up so that sending \ recieving doesnt interfere. I originally had a rediculous diagram drawn up with diodes which wouldnt have worked at all. After reading your post I had a eureka, what do you think?


Awww crap! I forgot to login at school. The diagram didnt turn out either, forgot to use "code":

input ______          ______output
output_____|         |______input

And I meant to say that I have my own idea, not that I had an idea of what you were talking about.
forgive my broked english, for I am an AMERICAN


Ah, ok. I guess I should explain.

An open collector output is basically a transistor connected between the dataline and the ground. This way, the transistor can *only* ground the output, it can never connect it to VCC (the supply voltage).

Why? Well, normal logic gates have two transistors on their outputs. One transistor can connect the data line to VCC, and the other transistor can connect the data line to ground. This leads to conflicts, where the output can never "idle", but is always active. Should one end try to ground the line, the other end will have connected the data line to VCC, leading to a shortcircuit and the destruction of one or both outputs!

So, at either end, there is an open collector output. That way, if both ends try to transmit at the same time, there's no short circuits, as either end can only ever ground the dataline.

However, the dataline needs to have a "pullup", which is basically a resistor connected to VCC. If neither end is transmitting a zero, then the resistor leaks enough power into the line to bring it up to VCC. If either end is transmitting a zero, then the open collector output can easily overcome the resistor and pull the line down to ground.

That handles the output. You can simply connect the data line to your input buffers, as the input side of it is nothing special. Most input buffers have a high resistance, so it's not a problem having more than one input.

The best way of dealing with the possibility that both ends might talk at once is to designate the pad a "slave", and the other end the "master". That way the slave will never talk unless the master tells it to. That's how most contended busses work.


Yeah, the pad only signals in response to the port. The port sends two bytes containing flags and rumble dat, and the controller responds with its button states.

I must say, this is over my head, but i did understand most of what you said and it makes sense. When I get my IC programmer I'll let you know what I come up with.
forgive my broked english, for I am an AMERICAN