Before we dig into implementation of what I have just explained about interrupt, I just want to explain
a little bit of theory on how we can get multiple buttons next to each other, like our example before
we have multiple buttons.
And we want to notify the interrupt if any of the buttons is pressed in order to launch the button scan,
in order to launch the function protein that is going to determine which button was pressed.
So why not actually connect all the buttons to different bins and set of the pins to interrupt?
Well, this does not work like that because interrupts bends or scores compared to the other pins.
You only have to interrupt pins, let's say, on Audrina Onoe and all the other bands cannot be configured
easily as interrupts.
This is why we cannot get all the buttons, connect them to forg pins and say, OK, whenever I press
this button, I want to go on launch.
This can function or routine.
This does not work because I only have two pins, so we need a mechanism to identify that.
OK, one of the button is a breast and I want to take this notification to my internal button.
Now this is my topology.
Do you remember our example?
We had four buttons and they were all connected to ground like that.
And here we had internal pull up.
Remember, we have configured all of these pins to pull up, meaning that there is a five volt right
here being great at the moment when the switch is not connected.
And when I connected, zero volt will be red.
So five volt was not connected, zero volt when this one is connected.
Same for Altmans.
Now this is my interrupting.
Now what I want to do it is if I press this, this, this or this, I want this Ben to be notified.
You might think, OK, why not just connect all of these four wires like this?
And if I close the switch like that, well, I'm going to get a signal going to the spin.
Well, this won't really work and this will cause a huge short circuit in your design.
So, again, switches open, you close it.
Now, this spin is notified, OK, that this bottle is breast and the interrupt is also notified, no
problem.
And it will start scanning and it will launch the script and it will launch the button scan protein.
But the short circuit is exactly right here because, well, all of these things are connected to each
other right now.
So that this zero volt, it's propagating all the way here.
It's going to interrupt, but it's going to the other wires as well.
So now this wayo, the other one is shorted.
It is the same as connecting this yellow wire with the red wire.
The red is connected to ground.
So it's the same as this yellow area is also connected to ground or to zero.
So now pink five will also get zero.
Same thing.
The next button is also connected at the same wire.
So it will be shorted with zero.
As you can see, if you follow the brown one, it's going also to pin number six, which will also be
shorted.
So now yellow and brown, both are connected to red, which is connected to the ground here.
So all of them are reading zero.
Same thing for the last bit.
Now all of the pins are shorted together and it seems like all of them are being pressed at the same
time because they are sure to remember what distinguished any pin it's being open or close.
When it's closed, it will be connected to ground.
Right.
This is what we are doing here.
Without closing any of these, we are taking the ground from a different wire.
See, we are propagating this ground to all of these wires, causing all of them to be at the ground.
So all the pins will read zero at the same time and interrupt.
We will not know anymore which button is being pressed.
So that's totally wrong.
So the circuit does not work and we need to introduce some new concept.
Here comes the delegates will come and rescue the situation for us at Diode.
Is it just an electronic component which we will see later when we start simulating it has two terminals,
A and B?
It's very simple.
If the applied voltage at A is higher than the applied voltage at B.
And none of them is floating, meaning none of them is disconnected, none of the terminals are disconnected.
Well, I will have a power flow or the comment will start flowing.
So it's exactly like this.
Take a look here now a the one that does not have this large dash.
Has a voltage of five, right, so we have five voltage, it's applied at A now, at B we have a ground
zero Volt.
It's applied right here.
So A is higher than B in terms of voltage.
So now power will conduct and current will flow between A and B, no problem.
Now, diets are not as simple as explaining them.
There is some threshold voltages.
There is some other concerns.
But in our application, I don't want to get too deep into the woods right now.
I just want to tell you that roughly when Germinal is higher than Terminal B in terms of voltage, current
will flow and the flow is going to be from A to B..
Now, let us say that I reverse the polarity, meaning that the side without a dash now has lower voltage.
And the side with the dash has a higher voltage.
Well, there is no current flow right here.
There will be no power conducted between A and B.
So the current will be blocked when this when we when we reverse the polarity now, same thing.
If you come here and you have a not connected to anything like it's a floating using a switch.
Remember, one of the side of the switches always is a floating and not connected to anything when the
switch is not pressed.
So assume that this side is not connected to anything.
Well, no power flow is going to happen right here.
So we're going to use this diode in order to solve our issue.
Now, let's take a look at this topology.
Every line is connected to a diet, as you can see.
Now, assume that I have closed the switch.
You're going to see that this ground of zero volt is going to propagate all the way.
Now, remember all of this.
I'll pull up five volts, right?
So I have a five volt pull up inside my interruptible.
So I have five volts here and I have a zero volt here.
So the higher voltage is at the side with no dash.
Right.
Volt, there's no dash.
Lower voltage with dash.
This is the dash.
It means that there will be a power of flow between A and B. So now we're going to have a power flow
and this diode will be like a wire so you can delete.
Now in this.
So in this configuration, when the voltage is higher than here.
You can delete this diode and just replace it with the wire.
So now I have this zero volt all the way here shorting this interrupt been meaning that interrupt end
will be detected.
However, let's continue and see what happens to the other bins.
Will it be shorted?
Well, right now I have five volt here because interruptible is also internal pull up or input pull
up.
So I have a five volt at this point.
However, let's take a look at the other side with the dash.
It's the floating.
It's not connected to anything.
What does this mean?
Can anything flow from this side now?
No, nothing can flow.
Now let's see what happens to the other bins.
As you can see here, we have zero vault because, well, this one is shorted and this one is like a
wire now because it's conducting.
So the zero vault will come here, however, cannot propagate to any of the pins.
No, it cannot.
Why?
Because I have no connection here.
Because I have zero vault at this site without the dash and I have a floating site on the other side.
So floating as this dashed side and zero vault at this site.
So there is nothing will propagate like the other case.
The zero vault cannot go all the way to win five again.
Go to the next one.
We have a zero vault.
Same thing.
It's not connected.
Nothing will flow.
Same thing here.
Nothing will flow.
So short circuit is now resolved.
And we can start applying this circuit to our design and we can simulate it right now, but if you have
any questions regarding the topology regarding diodes, please feel free to write to me in the Q&A and
I will be happy to explain it to you one more time.