Jump to content
IGNORED

Diodes


bluejay

Recommended Posts

Why are there 3 trillion different types of diodes? What do I need to use if all I want to do is limit the direction of a current in a computer? I'm going to use 8 diodes to OR 8 bits together for IRQ purposes. Speaking of which, when ORing all the IRQ pins together, will I have to use diodes to prevent, say, the YM3812's IRQ pin being forced to go high when the 65C22's IRQ is set? Or is that unnecessary?

 

Thanks in advance.

Edited by bluejay
Link to comment
Share on other sites

I would think a schottky diode would be good for this. Low voltage drop and fast switching. But really you could probably get away with the standard 1N4148 or 1N914. Just make sure the voltage drops are not too low. They could be used to trigger a transistor switch to bring voltages back to acceptable logic levels if necessary.

 

With an 8 diode OR gate you are already consuming the same footprint as a DIP 16 package. Why not use a multiple input OR/NOR IC?

  • Thanks 1
Link to comment
Share on other sites

I agree it would be easier to use diodes. Don't forget to invert the IRQ signal if necessary.

 

I don't fully understand your second question. From what I am reading it sounds like you could add an AND gate to the YM3812 IRQ input to prevent unwanted triggers. Or are you referring to having multiple output pins tied together? Maybe a schematic or block diagram would help.

  • Like 1
Link to comment
Share on other sites

Apologies for the terrible drawings. Didn't put much eddort into them.

nodiode.thumb.png.63d9721e23298dfee530a4ff99f0efa1.png

What I was saying was, if I simply tie multiple IRQ pins together, like the diagram above, then if the PC8477 triggers an interrupt, the YM3812's interrupt pin would be forced to go high as well whether or not the chip wants that to happen.

diode.thumb.png.a8193c50cb890602e51adeb15b4cc4ca.png

However, if I put diodes like these, the YM3812's IRQ pin can stay low while the PC8477 IRQ pin is high. The thing is, do I necessarily have to do this? Will I have to check the datasheet to see if a chip doesn't care what happens to the IRQ pin, or is there a general standard to how the chips react when Diagram #1 happens?

Link to comment
Share on other sites

No apology necessary, I think you applied just enough eddort to get the point across. Hehe.

 

My understanding is that if the outputs are all open collector then you could tie them together like in image 1, but with the addition of a pull-up resistor at each output. This way when the output is not logic 0 the resistor pulls it to logic 1. If the outputs are not open collector, even on just one device, then you would want to use the diodes like in image 2. Otherwise you would be shorting a logic 1 output from that device to a logic 0 output of another device and bad things will happen. You might be able to use diodes and pull-up resistors on only the devices that need them.

 

If it were me, I'd play it safe and use a pull-up resistor and a diode on each output just in case. This approach is partially out of ignorance but covers you for both instances mentioned above.

image.png.17052dd91a44c6e7ba658caeb1b8678c.png

 

  • Like 1
Link to comment
Share on other sites

18 hours ago, bluejay said:

Why are there 3 trillion different types of diodes? What do I need to use if all I want to do is limit the direction of a current in a computer? I'm going to use 8 diodes to OR 8 bits together for IRQ purposes. Speaking of which, when ORing all the IRQ pins together, will I have to use diodes to prevent, say, the YM3812's IRQ pin being forced to go high when the 65C22's IRQ is set? Or is that unnecessary?

 

Thanks in advance.

 

Why not just stack OR gates together?

So say if you had a 3 input OR gate you could do what you wanted with 4 of those. 3 that take your 8 inputs (the extra leg is be tied to ground) then the last 3 input OR gate will take the outputs of those and OR them. Giving you an 8 bit OR.

 

If you can find a 4 input OR then you could do with only three of those 2 to take you initial inputs and 1 to OR those together (still with the free leg tied to ground).

 

I just don't use diodes so that is how I would do. I can draw something up if you want to go that route.

 

This is the gist of how I would do it (this is only two ICs):

https://imgur.com/a/2Mhrq16

 

 

Edited by the_crayon_king
  • Like 1
Link to comment
Share on other sites

1 hour ago, wongojack said:

You are always working on something interesting @bluejay.  Is it hard to find OR gates?  I did a quick search and found a bunch:  OR 2 Input Logic Gates – Mouser.  Maybe I don't know what you are looking for.

It's easy to find regular OR gates, but what I'm looking for is an OR gate that has more than 2 inputs; like 4 or 8.

57 minutes ago, the_crayon_king said:

Why not just stack OR gates together?

So say if you had a 3 input OR gate you could do what you wanted with 4 of those. 3 that take your 8 inputs (the extra leg is be tied to ground) then the last 3 input OR gate will take the outputs of those and OR them. Giving you an 8 bit OR.

 

If you can find a 4 input OR then you could do with only three of those 2 to take you initial inputs and 1 to OR those together (still with the free leg tied to ground).

 

I just don't use diodes so that is how I would do. I can draw something up if you want to go that route.

 

This is the gist of how I would do it (this is only two ICs):

https://imgur.com/a/2Mhrq16

Sure, I could do that, but I just find it to be simpler to do it with diodes. However, I might start stacking OR gates if it ends up being cheaper than using diodes.

Link to comment
Share on other sites

Are your peripheral IRQ outputs active high or active low? If active high then OR will work but if active low then AND is probably a better choice.

 

Based on the pinouts I'm seeing the 6502 IRQ input is active low (/IRQ) so be sure to account for this.

Edited by emerson
  • Like 2
Link to comment
Share on other sites

3 hours ago, emerson said:

Are your peripheral IRQ outputs active high or active low? If active high then OR will work but if active low then AND is probably a better choice.

 

Based on the pinouts I'm seeing the 6502 IRQ input is active low (/IRQ) so be sure to account for this.

Huh, that’s something I haven’t considered. I shall buy some more AND gates. 

Link to comment
Share on other sites

Check to see what the idle state outputs are for all of your devices controlling the /IRQ. Hopefully all of them idle at logic high. Otherwise you will need to invert it before the AND gate.

 

Are all of your devices using the same /IRQ code? If different devices require different interrupt routines, how will you determine which device called the /IRQ? I have an idea if you need help with this.

  • Like 1
Link to comment
Share on other sites

Yep, I already checked that, seems like I’ll only need to invert the IRQ signal on the floppy controller. Can active low signals be open collector? Will I need a pull down resistor?

 

 Regarding the IRQ codes, I’ve also come up with an idea. Since I don’t have that many chips that actually use the IRQ signal, I can just hook them all up to the 6522. Then in the interrupt routine, I can read the interrupt flag register to determine on which pin the interrupt was requested. What was your idea?

Link to comment
Share on other sites

Not knowing the 6522 had that capability, my idea was to use an 8 bit latch to monitor the /IRQ inputs feeding the AND gate, and use the output of the AND gate to clock the /IRQs into the latch. The beginning of your /IRQ routine would load the latched data onto the data bus, see which /IRQ input was low, and execute the appropriate code with the jump table routines we discussed previously.

 

I like your idea since it utilizes hardware already in your design. Mine requires extra stuff.

  • Like 1
Link to comment
Share on other sites

My plan is to connect each IRQ pin of the peripheral chips to peripheral port control line of each 65C22. The 65C22 will trigger an interrupt on either the rising/falling (user adjustable) edge of each of the input, and by reading the peripheral data port corresponding to the control lines will clear that interrupt. So whenever something triggers an interrupt, I can verify what caused it, service whatever was causing it, and read a value from the peripheral port to clear the interrupt... Unless I understood something wrong.

Link to comment
Share on other sites

This thread inspired me!   I was working on a project that required a 4 input gate, and wondered if I could simply build it out of a combination of diodes and transistors. I'd never done any work like that before, so I decided to start by building a basic AND gate with diodes. I followed the instructions here: How to Build a Diode AND Gate Circuit (learningaboutelectronics.com).

 

 

image.thumb.png.c8c34668cec4f284e9c1c8522ccb6962.png

 

I decided to try and build this as a project with my niece and nephew. It was simple enough, but I was kinda surprised to find out that the AND gate will work as intended even if the cathode end of the diode is NOT connected to a voltage input. This made sense to me as I was building the circuit, but the instructions make a special effort to explain that the voltage has to be the same on the pull up as well as the input, so it kinda surprised me that as long as the inputs are NOT connected to ground that the logic works.

I realize that in an actual device it would only be useful to have the inputs switching between "High" and "Low" and not simply open, but why would the instructions make such a point about matching the voltage when the determining factor seems to be weather or not the cathode end is connected to ground (I used negative)?

I don't know if this is making sense. I'm just curious and thought I would ask you folks on this thread for your take on this.

  • Like 1
Link to comment
Share on other sites

Here are the responses I got to this question on the "All About Circuits" forum

 

 

-------------

"Most of the concepts in digital logic rely on the proposition that there are only two voltage levels. They don't normally deal with unconnected or undefined input levels. If node A for example is not connected to anything then it behaves as "if" it was connected to V+. The reasoning behind this is, that if no current flows through the device, then there can be no voltage across the device. In effect you have converted a 3 input device into a 2-input device, because node A has no effect on the output and it always looks like it is high, TRUE, or 1

The reason they mention this is that there are instances where an unconnected input can cause a real problem in a large and complex system. As you have discovered, a diode AND gate is not one of those places, unless the proper operation of a larger system requires 3 inputs."
 

 

-------------

"The article erred in a number of ways.

The demonstration uses an LED with a current limiting resistor as a test indicator. While a current limiting resistor in series with an LED is always a good idea, in this case the 470Ω resistor is 20 times lower than the 10kΩ pull-up resistor. Hence the 470Ω resistor has little effect.

With 10kΩ pull-up resistor, the max current available to the LED is 5V/10kΩ = 0.5mA which is barely enough to turn on a high efficiency LED. It would make more sense to interchange the two values.

I would have chosen a 1kΩ pullup resistor and a 2.2kΩ LED series resistor.

If you leave the inputs not connected we refer to this as a floating input. In this case, no current flows through the diodes. The full amount of current is available from the pull-up to the output LED. If any diode cathode is connected to ground the current takes the path of lowest resistance and no current flows to the LED. In other words, if the diode is forward biased the LED has no current. Hence what the writer meant was the input diode should not be forward biased for the AND gate to present a logic HI. If the input is connected to Vcc (+5V) then the diode is not forward biased (i.e. not conducting).

In this example it may be simpler to analyze it in terms of current rather than voltage."

Link to comment
Share on other sites

1 hour ago, wongojack said:

 

"The article erred in a number of ways.

The demonstration uses an LED with a current limiting resistor as a test indicator. While a current limiting resistor in series with an LED is always a good idea, in this case the 470Ω resistor is 20 times lower than the 10kΩ pull-up resistor. Hence the 470Ω resistor has little effect.

With 10kΩ pull-up resistor, the max current available to the LED is 5V/10kΩ = 0.5mA which is barely enough to turn on a high efficiency LED. It would make more sense to interchange the two values.

I would have chosen a 1kΩ pullup resistor and a 2.2kΩ LED series resistor.

Yeah... diode logic can be useful, but you've got to be careful. I use it in some of my game boards. To reduce risk, I make sure I have logic chips on both ends. For example, I wouldn't drive an LED with it, and I wouldn't go from one diode logic "gate" to another directly. It can be done, but you've got to be more careful in the math and voltage levels. In your example shown, for robustness, I'd be adding a transistor or IC inverter between the diode logic and the LED. As you've shown, you can make it work, but with the transistor/inverter added, you can drive more power to the LED, or hook up other items, such as motors (within power limits), etc.

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...