Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

8 bit switch? does it exist?

  1. Jul 5, 2005 #1
    i have 7 data lines coming out from a microcontroller... i need the 8th one to control where its going to, either to a 7 input on a RAM chip, or a 7 input on an LCD display.
    basically i think i'm looking for a 7/8 bit switch... does one exist? can anyone supply me with the name of such a switch? or the part number? or the datasheet?
    thanks in advance
     
  2. jcsd
  3. Jul 5, 2005 #2

    dlgoff

    User Avatar
    Science Advisor
    Gold Member

    You could use a couple of CD4016 (or CD4066) quad bilateral switches.

    Regards
     
  4. Jul 5, 2005 #3

    berkeman

    User Avatar

    Staff: Mentor

    Since they are digital lines, you should solve this digitally. You can use a couple '245 Octal Bus Transceivers and control which direction(s) get selected with your 8th bit, for example.

    Are these lines bidirectional? You need to define the path selection options and the direction selection options, and then just work out the logic to do the routing. You could use discrete NAND gates for that matter, or a PAL to do this function.
     
  5. Jul 5, 2005 #4

    dlgoff

    User Avatar
    Science Advisor
    Gold Member

    He said he wanted a switch. 4016s are switches for digital lines.
    Sounds a bit complicated for what he wants to do.

    Regards
     
  6. Jul 5, 2005 #5

    berkeman

    User Avatar

    Staff: Mentor

    Actually, my databook calls them digitally controlled analog switches, which is what they are architecturally. I just wanted him to think more in the context of the task that he was talking about. If I gave him an interview question to mux his uC's lines between a RAM and an LCD controller, and he used analog switches to do it, he'd fail the interview. The way you route digital lines around is with digital logic and muxes, not with analog switches. And I mentioned PALs to maybe get him to poke around the net some to learn what PALs are used for, and why that would be how he would do it in the real world. Even at a highschool level, PALs are very handy, and PAL programmers are cheap.
     
  7. Jul 5, 2005 #6
    Most IC's come with enable pins. Why not just connect the lines up to both devices and use the 8th bit as an address line???

    What LCD and RAM are you using? What's the function of the circuit? What other devices have spare cells in them?
     
  8. Jul 5, 2005 #7
    ok, well i'm about to check up on the 4016, but i've checked out the 4066, and that's just a straight on/off switch. i want a switch that will just change the data path from the uC to the SRAM or to the LCD. kinda like the track change for a railway i would imagine. and the 4066 is unsuitable for that
    i'v found something called a "16to8 bit multiplexing/demultiplexing bus switch" which looks perfect... but i was wondering if there was another way, because that chip only seems to be made by one manufacturer... and i cannot get hold of that exact one. maybe other companies make it? i dont know, i havent been able to find any though :(
     
  9. Jul 5, 2005 #8
    in reply to delta, the enable pins are being used for a completely different operation. i cant touch them. i have 7 input pins on both the LCD and the SRAM... and 8 output of the port of the uC. therefore i have an extra line that i can use from the uC to control the 'switch' i'm looking for :/
     
  10. Jul 5, 2005 #9
    Use the 8th output to switch between the LCD and the RAM. Ram and LCDs have an enable. Split the 8th bit into two lines. Invert one of the lines. Use the inverted line to enable one of the devices and the noninverted line to enable the other---this is assuming both devices use the same logic level to enable them which is not always the case. A single 7404(or cmos equiv if you wnat) IC should do the trick. You are multiplexing a bus by doing this and would be well served to learn what MUX'ing is and how best to accomplish it.

    Good luck.
     
  11. Jul 5, 2005 #10
    basically.. this is EXACTLY what i'm looking for...
    http://www.pericom.com/pdf/datasheets/PI5C3390.pdf
    but, is there anything similar to that, because i cannot get my hands on one of those :( it explains what i'm after. look at the block diagram it gives. i just need to connect the /BEN & /AEN lines together with a not on the one and connect that to my 8th bit.
    anyone know of anything similar to this? like a simple IC? or if there's another manufacturer that makes this chip ?
     
  12. Jul 5, 2005 #11
    Read my post above.
     
  13. Jul 5, 2005 #12
    do you have any website/info on how to implement an 8:16 multiplexer then? and what parts to use?
     
  14. Jul 5, 2005 #13
    my problem here, faust9, is that i do not have an enable pin on the LCD. it is one of the 7 that need to pass through the MUX. and it cannot be linked directly otherwise a signal passing to the SRAM that includes that bit could accidentally intefere with the LCD and sink current or interfere with my address that is to be written to the SRAM.

    i'v found the PI5C3390 and the IDTQS3390, however it seems the suppliers in this country do not have those chips. also, those are both 16-8 MUX bus switches... but i need an 8-16 MUX bus switch. any ideas on how to create one from lesser components?
     
  15. Jul 5, 2005 #14
    I explained it above. You don't need an 8:16 MUX to do what you've asked about.

    You only need an inverter on the 8th bit (the free bit you mentioned a few posts back that you wanted to use as a switch). Send the 8th bit to one device directly and send the 8th bit through an inverter (74hc04) to the other device. When the 8th bit goes high one device will be enabled and the other disabled. When the 8th bit goes low the exact opposite will occure. If you only need 7 data lines from an 8 bit bus and want to access two device then just use an inverter. A PAL would be the best solution because LCD's usually have a limited instruction set so the full 7bit bus uses addres space not needed by the LCD which could be used for additional ram/rom but the easy solution is an inverter on the 8th bit. Google is your friend. Google MUX or multiplexor.

    Good luck.

    [edit] just saw the post above. Use a latch between the LCD and the data bus and the 8th bit to 'latch' the lcd data in. This is how old addr:data buses used to be MUX'ed.
     
    Last edited: Jul 5, 2005
  16. Jul 5, 2005 #15
    How do you not have an enable available for your RAm or LCD? Your system will not work unless you have some way of telling the RAM/LCD when to read data and when to write data.
     
  17. Jul 5, 2005 #16

    berkeman

    User Avatar

    Staff: Mentor

    It's a write-only RAM?
     
  18. Jul 5, 2005 #17
    I can only recommend you continue searching for an 16-8 mux supplier.

    Failing that you're left with getting a couple of buffer chips. One for the LCD and one for RAM, both connecting to the data bus from the microcontroller. The 8th bit would enable either one buffer or the other.
     
  19. Jul 5, 2005 #18

    dlgoff

    User Avatar
    Science Advisor
    Gold Member

    From the National Semiconductor data book: "The CD4016BM/CD4014BC is a quad bilateral switch intended for the transmission or multiplexing of analog or digital signals."

    Try it. You'll like it. It's cheap too.

    With four you can do exactly what you're wanting.

    Regards

    edit: spelling
     
    Last edited: Jul 5, 2005
  20. Jul 5, 2005 #19

    dlgoff

    User Avatar
    Science Advisor
    Gold Member

    Maybe but he would be switching data by now.

    Regards
     
  21. Jul 6, 2005 #20
    mmkay.
    firstly, the RAM enable pin is using a different port, and the LCD is configured in a 4-bit manner such that there is no set 'enable' pin, the 'enable' pin is to be high in the wait state where it transfers info on the input pins to the internal buffer register, then on the low, it outputs that internal buffer register to the display. therefore even if the LCD is in the 'off' mode, the pins are still connected and still receiving data, and might still sink current which would interfere with the address that is to be written to the SRAM. that is why the so-called 'simple' solution is not applicable :( (in this case)

    yes, i'm still a student, but no, this is not part of any project or anything! i'm helping my lecturer to build expansion boards to be used in 3rd year practical lab work on microcontrollers... lecturer is too busy with adminish stuff like marking exams and such.
     
  22. Jul 6, 2005 #21
    Juming ,
    what you are calling SRAM , is that Serial RAM ??
    like this
    http://pdfserv.maxim-ic.com/en/ds/DS1200.pdf
    because a seven bit static ram isnt very useful...
    berkeman here sugested using a 245 , which is exactly what you should use because the outputs are Tri-Stated...that is what they are made to do
     
  23. Jul 6, 2005 #22
    hehe.. no it's static ram... but the other address byte and the data byte are going to another port. this is my only problem here, these A8-A14 address lines need to have the same input as bits 0-6 of the LCD, from PORT C of my uC. the 8th bit of the uC can therefore be used to control the switch... to channel the other 7 either to the SRAM or to the LCD. but the problem is, i dont have a switch...
     
  24. Jul 6, 2005 #23
    the 245 is not what i'm looking for. i need 16 outputs.
    i think what i'll do is use 2 244's and connect the input lines together and to the port, and invert one of the enable lines and connect those together.
    what do you think?
     
  25. Jul 6, 2005 #24
    i do not need to read in from either the LCD or the SRAM, so the uni-directionality of the 244 is ok
     
  26. Jul 6, 2005 #25

    berkeman

    User Avatar

    Staff: Mentor

    It sounds like you're on the right track. BTW, what you would do in a real-world uC design is use some logic, generally either a PAL, CPLD or FPGA to decode your addresses into a memory map that has different memory address areas dedicated to each peripheral. Your logic would decode the appropriate CE-, WE-, R/W-, etc. signals for each peripheral based on what the uC was doing with the memory bus and its control output signals. For example, it's pretty common for a uC to have external PROM/flash for program storage, external SRAM, and maybe an external UART like the 16C550 series to talk RS-232 off-board.

    Here's an engineering bulletin that I helped write many years ago that talks about how to design external memory interface logic for a particular microcontroller (the Neuron chip uC, used with LonWorks control networks). Note that you can't just throw down logic (or even analog switches) in the memory interface without doing at least some basic memory timing checks to be sure that it will work with the speed grade of memories and logic that you've chosen:

    http://www.echelon.com/support/documentation/bulletin/005-0013-01D.pdf

    Have fun with the project! -Mike-
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook