Jump to content
bluejay

Diodes

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks. I'm using diodes because I simply cannot find multiple input OR ICs. Even if I could I doubt it would be very easy to get ahold of one. Much simpler to use diodes.

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Oh, alright.

 

Regarding the diodes, any diode that is a schottky diode and complies with the voltage and amerage ratings will work fine on anything, right?

Share this post


Link to post
Share on other sites

That is my assumption yes. Be sure to look at the switching speeds also as the propogation delay will effect how fast the IRQ is called.

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Thanks; I found a single 4 input OR gate in DIP, and a whopping zero 8 input OR gates in DIP. I can't order from mouser right now, but I'll look into ordering one on ebay or something. Thanks!

  • Like 1

Share this post


Link to post
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

Share this post


Link to post
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. 

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

@emerson It's just a 6522 except CMOS and lots of bits and pieces that make it better than the original. Here's the datasheet for the W65C22 which seems to be the most popular, although I am using an R65C22.

 

Here's the datasheet for it: w65c22.pdf

Share this post


Link to post
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.

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...