Saturday, August 21, 2010

Digital Circuit Design Problem #1

Hi everybody. Well, first of all, I would like to apologize for the long delay in this post. Actually, I've been a bit busy over the past few months. Anyways, here I am again, continuing forward on our digital path.

Now that we know the basic gates and some of their properties, we would like to build some circuits using these gates. Let us get our hands dirty then. Let's try one.

Well, here is a problem statement:
You have an automatic lock in your home. It has a 8-bit key set into it, which can be set  as and when required from inside the house. There is a 8-bit keypad outside the door. Only if you type in the right key, the door will open. You have to design this lock.

Before going to find the solution, I would strongly suggest that you download this jar software and try to simulate the solution on this first.

Solution:
Before looking at the solution, please put your brain cells to some work. Fire them up and try to analyze the problem. Try to find a solution yourself. If it becomes impossible or difficult, then move onto the solution I'm providing here. Also, your solution may be different from what I'm proposing here. Please post your solution too for the benefit of others.
So, how to proceed? Let's say the key set into the lock is 10010010. So, when we set the same key in the keypad, only then the door will open. That means each of the bits have to be matched to the corresponding bit of the key set. Now, is there any gate we've studied so far that does this trick of comparing? Let's take a look again at the truth tables of the gates. Do you find any such gate that gives a logic '1' only when both the inputs match?

On taking a close look, we find that EXNOR gate does exactly that.


So, now all we need to do is put one exnor gate between every bit of the keypad and the corresponding bit of set key. But does this solve the problem? Let's say we have typed in the right key. So that every EXNOR gate gives a logic '1'. We have 8 exnor gates giving a logic '1' at its output. So, which do I connect to the lock to open it? The answer should be all of them. But then the lock will open on only one signal. So, what do we do now? Now, let's think a bit more. What if there was a gate that would give '1' as an output only if all of its inputs are '1'? That is, a '1' is obtained only when all the bits of the keypad match with those of the key. And voila, we find such a gate yet again. It's an AND gate. Now I'm loving these gates. They do exactly what we want them to do, don't they?


We can use a 8 input AND gate here. We connect the outputs of all the EXNOR gates to this AND gate, and the output we connect to the lock. The final circuit would look somewhat like this. 



The circuit I've shown here has been simulated on Logisim. Do try out your circuits on this software.

We'll try out other circuits in upcoming posts. In the meantime, try out your designs and try to find out other digital circuit problems. And most important, don't forget to post your comments/suggestions.