Announcement

Collapse
No announcement yet.

IC for 3 input latching XOR logic?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • IC for 3 input latching XOR logic?

    I've got a channel switching scheme that seems to me needs something that I can't easily find: a 3 input XOR logic that latches. I can make it using relays, but getting 3PDT momentary switches is not cheap and neither are relays compared to switching ICs. Or I can program a MCU, but I've never been successful at doing that so if I don't have to go that route I'd prefer not to. So is there any way I can reproduce the switching of the attached ladder diagram with off the shelf ICs?

    S = switch
    C = coil
    R = relay contact
    The relays used for this are DPST with "a" and "b" being each pole of the relay.
    Attached Files
    -Mike

  • #2
    I don't know that it is XOR so much, you need latching switches that reset all others.

    The partial datasheet page below is from notes from an old old project. I masked off some irrelevancies. Basically a 10k pullup to each input, and the stomp switch grounds the input for a low at the LS373. (I think I went over to a LS374 later, but the concept is the same.) Also from each input is a line to a LS133 13-in NAND, pullup unused inputs. So ANY switch closure makes the 133 output high. This runs around to the latch input of the 373. This latches the input. and the cap prevented the thing from unlatching when you released the switch. Just ground pin 1 of the 373 so the outputs are always enabled. The corresponding output for the input switch will then be latched on until some other one is pressed. it was not an issue in my project if someone pressed two switches at once. You are not likely to either.

    You can do whatever you want with the output, drive an opto, control a transistor and relay, whatever. You may need to invert the outputs, so a simple invertar across the row would be enough.

    If you only want 3 circuits, you could scale it down, use a three-in NAND, maybe some other latch would be cool. On my thing I had two 373s in a row for 16 switches.



    A while later I found the little magazine article with similar intent.
    Attached Files
    Education is what you're left with after you have forgotten what you have learned.

    Comment


    • #3
      Logic gates have no memory by definition, so they can't latch. If they did, we wouldn't call them logic gates.

      The devices that give memory to logic circuits are called flip-flops and latches, and I'd guess you need some of these. Enzo's circuit uses the '373 which is an octal latch.

      For hobby projects I only keep two logic chips around, the 4013 D-type flip-flop and the 4011 quad NAND gate. Since you can make any logic gate out of a bunch of NAND gates (EE/CS students are traditionally forced to prove this with De Morgan's theorem) it follows that you can make absolutely any logic circuit out of just these two chips.
      "Enzo, I see that you replied parasitic oscillations. Is that a hypothesis? Or is that your amazing metal band I should check out?"

      Comment


      • #4
        They are the 2N3904 of logic. That's a lot of little chippies to replace a couple 373s and that big NAND though. PLus my thing had other strobe stuff going on.


        Hey! Lookit the NANDs on that girl!
        Education is what you're left with after you have forgotten what you have learned.

        Comment


        • #5
          Thank you both for your help. With the 374 sheets Enzo posted and some stuff I dug up on the 4013 I've been able to model both XOR latching switches and push-on/push off-switches. This will be perfect for channel switching as well as foot switchable FX loop/Solo/EQ/etc.

          Now the 374 activates by the switch being held low and the 4013 activates by the switch being held high. The outputs are also opposite of each other, the 374 goes low and the 4013 goes high. Aside from single using single 3904/3906 transistors to invert the I/O of either IC (which is what I've got drawn up now on the 4013), is there a more elegant way of making each one switch using the same logic?
          Last edited by defaced; 02-24-2009, 01:02 PM. Reason: Clairification
          -Mike

          Comment


          • #6
            Kevin O'Connor presents a circuit in a couple of the TUT books. He used a 40175 which is a quad flip-flop. His circuit looks pretty flakey to me. He uses diodes to derive a clock pulse from the data lines and he also uses it to clear all the flops which really isn't needed. The 4000 series CMOS chips have the advantage that they can run on 15V and control JFET switches directly from the outputs. Sorry, I can't view your attachment. At 600K it's about 30 times bigger than it needs to be.
            WARNING! Musical Instrument amplifiers contain lethal voltages and can retain them even when unplugged. Refer service to qualified personnel.
            REMEMBER: Everybody knows that smokin' ain't allowed in school !

            Comment


            • #7
              Thanks LT. I'll look into the 40175 and reduce the size of that image when I get home tonight.
              -Mike

              Comment


              • #8
                Same image but smaller file size. Each switch is one pole of a 3PDT momentary switch. The relay contact in parallel with the NO switch contact latches the rung of the ladder when the switch is pressed.
                Attached Files
                -Mike

                Comment


                • #9
                  If the logic is the wrong way round, that's what NOT gates are for. The 74HC04 has six to a chip. NAND gates can also be wired as NOT by just connecting both inputs together.

                  Mixing diodes, transistors, etc. into logic circuits is known as M2L (Mickey Mouse Logic) and is best avoided. We've probably all done it (a classic example is making a one-shot out of a Schmitt inverter, capacitor and diode) but they eat into your noise margins and change behaviour with temperature.

                  Can I also humbly suggest that you try to avoid thinking in terms of ladder logic... The limits of our language are the limits of our world, and ladder logic is a pretty unwieldy language. You're trying to take your metaphor of multi-pole relays in a 1920s elevator controller, and paste it onto digital logic circuits that don't at all work the same way.

                  For instance, you're considering using 3PDT switches, but as soon as you started using logic in a product, one of the first things you'd do is change all the switches to single-pole, reducing their cost to offset the cost of the logic chips, and reducing the number of debounce circuits needed. You can have any number of "poles" from a single-pole switch in your logic circuit by using AND gates as selectors.

                  Or if you absolutely must think in terms of ladder logic, try using optoisolators or 4066 analog switches as your "relays". I've seen people do this, and it looks weird, but it works. The only gotcha is that you can only access one end of a 4066's "coil"
                  Last edited by Steve Conner; 02-25-2009, 11:47 AM.
                  "Enzo, I see that you replied parasitic oscillations. Is that a hypothesis? Or is that your amazing metal band I should check out?"

                  Comment


                  • #10
                    Thank you Steve. The only reason I'm explaining this using ladder logic is that I don't yet have the tools to explain it another way, and it was a verbatim example of an e-stop circuit I remembered from my industrial controls class from college.

                    Is there a book that breaks down digital logic and circuits in a manner that simplified enough for the non EE? I see many sites that explain the math and the logic, but none that I've found that go beyond that into the practical of making a circuit out of the symbols. For example, I look at a data sheet for a chip and I see pins with labels but even after searching online I usually come up short on an explanation for what those labels are or how the pins should behave.
                    -Mike

                    Comment


                    • #11
                      I hope other people will recommend books, but the best one I can think of would be Don Lancaster's TTL Cookbook. It's older than me, and you can hardly get TTL logic any more, but I imagine everything in it would work with the more modern 74HC chips.
                      "Enzo, I see that you replied parasitic oscillations. Is that a hypothesis? Or is that your amazing metal band I should check out?"

                      Comment


                      • #12
                        When interfacing switches with digital logic, I like to use the set-reset flipflop because it makes you immune to switch bounce. A 4013 could be used but in the diagram below I made the flipflop out of NAND gates. On the Reset side I used 3 input gates to implement the function whereby setting one flop resets the other two. I suppose I could have used more diodes. When one flop is set, the low going transistion goes through the cap and diode and resets the other two flops. The resistor around the diode just makes it so the cap doesn't hit the input protection too hard on the low to high transistion.

                        The 10uF cap and diode on the top switch is just something to set the initial conditions when the circuit powers up. I'm just guessing on the .01 cap value. You might have to go higher to .1uF. Relays can just be connected around the LEDs and resistors.
                        Attached Files
                        WARNING! Musical Instrument amplifiers contain lethal voltages and can retain them even when unplugged. Refer service to qualified personnel.
                        REMEMBER: Everybody knows that smokin' ain't allowed in school !

                        Comment


                        • #13
                          I got the circuit Enzo posted working on a bread board, thank you. So this'll alloy me to switch channels.

                          To accompany the channel switching circuit, I started searching for a push on/push off circuit that uses a momentary switch for the push button. This would be for turning on/off an effects loop, GEQ, solo or whatever. I ran across the circuit that's at the bottom of the attached pdf and in simulation it works, but in practice I'm getting an output that doesn't unlatch. Thoughts? I'm using the TI 4013 for this. http://mouser.com/Search/ProductDeta...ey595-CD4013BE

                          I've also got two of Lancaster's books on order, the TTL and CMOS cookbooks. Should be here the middle of next week.
                          Attached Files
                          -Mike

                          Comment


                          • #14
                            In the top circuit a trick is used. Notice that the Reset input is tied high. Logically, you should never engauge Set and Reset at the same time, it's not a "legal" state. But when you do, Q and Qbar both go high (an ambigous state). When Set is released, the flop returns to the Reset state where Q is low and Qbar is high. In the bottom circuit, the Qbar to D connection forces the flop to toggle on any clock. The trouble with that circuit is switch contacts can bounce and give an unpredictable number of clocks leaving the flop in a random state. Thats why I prefer the Set-Reset flop. No matter how many times you Set it, it's still Set until you Reset it. No unpredictable outputs. Not the handiest thing for a reverb on-off function however.

                            The diagram below shows a Set-Reset flop setup with push-on push-off switch to make a "sticky" function. You could use a 4013's S and R inputs and tie the switch to +. Or use a SPDT momentary switch to a S-R flop and then to a toggle flop.
                            Attached Files
                            Last edited by loudthud; 03-08-2009, 04:46 AM.
                            WARNING! Musical Instrument amplifiers contain lethal voltages and can retain them even when unplugged. Refer service to qualified personnel.
                            REMEMBER: Everybody knows that smokin' ain't allowed in school !

                            Comment


                            • #15
                              There's been a solution to this problem, and for exactly the same use, posted at (geofex) since January 2001. Go
                              here.

                              The trick is in figure 7, and you need a transparent latch, not multi-input XOR logic. I first went at it from the standpoint of making each input be a set to one latch and a reset to the others, went through illegal state latches, etc, etc. The answer is to have any input cause a clock to a transparent latch with at great, wide OR gate, and to have the inputs all latch from that same signal. The timing is tricky, but the specific gate I mention makes it easy, as the hold time for a signal into the latches is actually negative.

                              I've gotten this to work for more normal CMOS transparent latches, but it takes an R-C network on each input to hold data valid after the clock drops.
                              Amazing!! Who would ever have guessed that someone who villified the evil rich people would begin happily accepting their millions in speaking fees!

                              Oh, wait! That sounds familiar, somehow.

                              Comment

                              Working...
                              X