# Circuit for reversing 8 data lines?

Discussion in 'Electronic Basics' started by Rik, Apr 24, 2005.

1. ### RikGuest

I'm trying to solve a little problem with a (hopefully) simple
circuit, and I'm not really sure where to start searching (I tinker
with electronics, but haven't attempting building something from
scratch yet...)

What I have is 8 data lines coming out of a cartridge-type device (D0
through D7). Depending on a condition (physical on-off type switch
hopefully) I need to reverse all 8 lines as they come out of the
cartridge.

So, if the switch is off, D0 out of the cartridge would go straight
through to where D0 should connect on the main board, D1 to D1, etc...

If the switch is on, D0 should now connect to where D7 would normally
connect on the main board, D1 to D6, D2 to D5 and D3 to D4.

Or, basically, a circuit that would emulate 8 SPDT switches being
thrown all at once one way or the other...

Seems like this has to be a simple enough circuit to me... (or is
there simply a chip that will do this?)

Thanks for any help, apologies in advance if this is in a FAQ
somewhere... Didn't see anything obvious when I looked...

Rik

Jmorg
(at)
[dot]
net

2. ### petrus bitbyterGuest

Rik,

Suppose you only need the logic levels then two pieces of old 74LS157 or
CD40257B, one switch and one resistor will do the trick.

petrus bitbyter

3. ### ChrisGuest

Good morning, Rik. Thanks for looking first. I'm assuming you've got
5V digital logic signals you're switching, and that you're not
particularly concerned about obtaining the fastest switching speed.
Given these assumptions, there is a one-chip solution. A small EPROM
will do the job quite nicely with inputs to spare. The problem is, if
you had an EPROM burner, you certainly wouldn't be asking -- you'd have
it done by now.

Well, there is a two-chip solution for you. It's called a data
selector, and does exactly what you ask. For a 74HC157, it will switch
between two sets of four data signals, depending on what the control
signal says. Look at the data sheet:

http://www.fairchildsemi.com/ds/DM/DM74ALS157.pdf

and then look at this diagram (view in fixed font or M\$ Notepad):

1 2 3 4 5 6 7 8 9
o o o o o o o o o
| | | | | | | | |
| | | | .----------------------------------o
| | | | | | | | | |
o----------------------------------------------------------. |
| | | | | | | | | | |
| o----------------------------------------------------. | |
| | | | | | | | | | | |
| | o----------------------------------------------. | | |
| | | | | | | | | | | | |
| | | o----------------------------------------. | | | |
| | | | | | | | | | | | | |
| | | | .----------o | | | | | | | |
| | | | | | | | | | | | | | |
| | | | .----------------o | | | | | | |
| | | | | | | | | | | | | | | |
| | | | .----------------------o | | | | | |
| | | | | | | | | | | | | | | | |
| | | | .----------------------------o | | | | |
| | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | |
.--o--o--o--o-----o--o--o--o--. | .--o--o--o--o-----o--o--o--o--. |
| A1 A2 A3 A4 B1 B2 B3 B4 |1| | A1 A2 A3 A4 B1 B2 B3 B4 |1|
| Selo-' | Selo-'
| 74HC157 | | 74HC157 |
| Strobe o-. | Strobe o-.
| Y1 Y2 Y3 Y4 | | | Y1 Y2 Y3 Y4 | |
'----------o--o--o--o---------' | '----------o--o--o--o---------' |
4| | | | | 4| | | | |
o o o o === o o o o ===
GND GND
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

The above of course assumes you've got Vcc and GND connected to the
appropriate pins on the ICs. I've left figuring out the pin numbers to
you. The logic of the chip is as follows:

If STROBE is high, the outputs are Tri-State (not connected to
anything, act like open ckt). So, we'll tie both low to make the chip
"always on".

Assuming STROBE is low, then if Sel (your logic signal 9) is low, Y
will have the same logic level as A. If Sel is high, Y will have the
same logic level as B. So, if you wire up the chips with your logic
signals 1-2-3-4-5-6-7-8 as shown above, when 9 is low, the output will
be 1-2-3-4-5-6-7-8. When 9 is high, your output will be
8-7-6-5-4-3-2-1. I guess that's pretty much what you want.

You can make the logic signal at pin 9 with your switch like this:

VCC
+
|
.-.
| |10K
SW1 | |
'-'
_/ | 9
.--o/ o--o---->
|
===
GND
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

The HC family is made for 5V logic. If your requirements are
different, this solution might not work for you. In that case, a quad
DPDT analog switch or some 4000-series logic or something else might be
a better solution.

So, look at these questions to see if this is OK. If any of your
a little better to get another answer:

5V power supply: YES
5V logic: YES
Digital signals: YES
High speed requirements: NO

Good luck
Chris

4. ### ChrisGuest

By the way, there is a "low-tech" solution, too. Scrounge around and
find yourself one of those serial port "A-B" switches. The ones built
for DB9 connectors actually switch all nine pins from two inputs to one
output. Get some connectors, and go to work. Simple, easy, and you
don't have to worry about power supplies or which IC pin is pin 1 (it's
the one with the little circular indentation or dot next to it). Just
make sure you keep the pin numbers on the connectors straight (remember
that the Male is the mirror-image of the Female, since they plug into
each other) and you'll be fine.

Good luck
Chris

5. ### mikeGuest

I'd use a GAL20V8. Main reason is that you don't have any traces
crossing over and can lay it out on a one-layer pcb.

Or you could use two octal buffers with tri-state outputs. Cross
couple them and enable one at a time. YOu might even find a crosspoint
switch that could do it in one chip.
So, it depends more on how fast the data path has to be and availability
of components. CMOS multiplexers work at low speeds.
mike

--
Return address is VALID but some sites block emails
..
Wanted, PCMCIA SCSI Card for HP m820 CDRW.
FS 500MHz Tek DSOscilloscope TDS540 Make Offer
Wanted, 12.1" LCD for Gateway Solo 5300. Samsung LT121SU-121
Wanted 12" LCD for Compaq Armada 7770MT.
Bunch of stuff For Sale and Wanted at the link below.
MAKE THE OBVIOUS CHANGES TO THE LINK
ht<removethis>tp://www.geocities.com/SiliconValley/Monitor/4710/

6. ### ChrisGuest

Sorry -- something above wasn't clear. This is the datasheet for the
HC157:

http://www.fairchildsemi.com/ds/MM/MM74HC157.pdf

And all references above to 5V obviously mean "5V or less".

Really should wait for the second cup of coffee before posting.

Chris

7. ### John FieldsGuest

---

XX541
+-------+
+-----------------|A0 D0|-----------------+
| +---------------|A1 D1|---------------+ |
| | +-------------|A2 D2|-------------+ | |
| | | +-----------|A3 D3|-----------+ | | |
| | | | +---------|A4 D4|---------+ | | | |
| | | | | +-------|A5 D5|-------+ | | | | |
| | | | | | +-----|A6 D6|-----+ | | | | | |
| | | | | | | +---|A7 D7|---+ | | | | | | |
| | | | | | | | |__ __ | | | | | | | | |
| | | | | | | | +-|OE1 OE2|-+ | | | | | | | |
| | | | | | | | | +-------+ | | | | | | | | |
Vcc>--[R]-+-|-|-|-|-|-|-|-|-+-----------+ | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | | | | XX541 | | | | | | | |
| | | | | | | | | +-------+ | | | | | | | |
DI0>------|-+-|-|-|-|-|-|-|---|A0 D0|---|-|-|-|-|-|-|-+-->DO1
DI1>------|---+-|-|-|-|-|-|---|A1 D1|---|-|-|-|-|-|-+---->DO2
DI2>------|-----+-|-|-|-|-|---|A2 D2|---|-|-|-|-|-+------>DO3
DI3>------|-------+-|-|-|-|---|A3 D3|---|-|-|-|-+-------->DO4
DI4>------|---------+-|-|-|---|A4 D4|---|-|-|-+---------->DO5
DI5>------|-----------+-|-|---|A5 D5|---|-|-+------------>DO6
DI6>------|-------------+-|---|A6 D6|---|-+-------------->DO7
DI7>------|---------------+---|A7 D7|---+---------------->DO8
| |__ __ |
Vcc>--[R]-|-----------------+-|OE1 OE2|-+
| | +-------+ |
+------>| <------+-----------+
|
GND>--------------O

8. ### John FieldsGuest

---
Oops...

XX541
+-------+
+-----------------|A0 D0|-----------------+
| +---------------|A1 D1|---------------+ |
| | +-------------|A2 D2|-------------+ | |
| | | +-----------|A3 D3|-----------+ | | |
| | | | +---------|A4 D4|---------+ | | | |
| | | | | +-------|A5 D5|-------+ | | | | |
| | | | | | +-----|A6 D6|-----+ | | | | | |
| | | | | | | +---|A7 D7|---+ | | | | | | |
| | | | | | | | |__ __ | | | | | | | | |
| | | | | | | | +-|OE1 OE2|-+ | | | | | | | |
| | | | | | | | | +-------+ | | | | | | | | |
Vcc>--[R]-+-|-|-|-|-|-|-|-|-+-----------+ | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | | | | XX541 | | | | | | | |
| | | | | | | | | +-------+ | | | | | | | |
DI0>------|-|-|-|-|-|-|-|-+---|A0 D0|---|-|-|-|-|-|-|-+-->DO0/7
DI1>------|-|-|-|-|-|-|-+-----|A1 D1|---|-|-|-|-|-|-+---->DO1/6
DI2>------|-|-|-|-|-|-+-------|A2 D2|---|-|-|-|-|-+------>DO2/5
DI3>------|-|-|-|-|-+---------|A3 D3|---|-|-|-|-+-------->DO3/4
DI4>------|-|-|-|-+-----------|A4 D4|---|-|-|-+---------->DO4/3
DI5>------|-|-|-+-------------|A5 D5|---|-|-+------------>DO5/2
DI6>------|-|-+---------------|A6 D6|---|-+-------------->DO6/1
DI7>------|-+-----------------|A7 D7|---+---------------->DO7/0
| |__ __ |
Vcc>--[R]-|-----------------+-|OE1 OE2|-+
| | +-------+ |
+------>| <------+-----------+
|
GND>--------------O

9. ### JamieGuest

you need a tri-state buffer.
just simply wire the output of one chip in reverse order.
http://cache.national.com/ds/54/54LS367.pdf
a 74LS541 is most likely what you want. that one has an 8 bit
set, so you would only need to of them.
just wire all the inputs to the same pins and cross wire the
outputs .
the G1 and G2 are used to select the chips in out of the circuit along
with the enable etc..