# three 1's detector circuit

Discussion in 'The Projects Forum' started by abuarab88, Feb 19, 2009.

1. ### abuarab88 Thread Starter Member

Nov 6, 2008
19
0
hello everyone
i am attempting to design alogic circuit that give me 1 when i have three 1's adjacent and zero otherwise
for example:
01110101 input must give 1
01011011 input must give 0
01011100 input must give 1
as you see guys that the input number has 8-bits

thank you all

2. ### KL7AJ AAC Fanatic!

Nov 4, 2008
2,043
292

Oh my...isn't THIS a fun one!

If you have to do it with combinational logic, it will be a nightmare.

HOWEVER....if this is a clocked application...that is, if every bit lasts for a precise length of time, you can use a simple integrator and threshold detector.

Is this a timed circuit or not?

eric

3. ### KL7AJ AAC Fanatic!

Nov 4, 2008
2,043
292
Okay....it can be done combinationally without TOO much nightmare.

You need EIGHT three-input nand gates, and a single EIGHT input Nor gate. (YOU can build this with a few 2 input NOR's)

Eric

4. ### KL7AJ AAC Fanatic!

Nov 4, 2008
2,043
292

Build an eight line bus, with each line representing a bit. Number each bus 1 through eight.

Connect 1st 3 input NAND gate (inputs) to bus 1 2 3
Connect 2nd ....................................to bus 2 3 4
Connect 3rd .....................................to bus 3 4 5
Connect 4th......................................to bus 4 5 6
Connect 5th......................................to bus 5 6 7
Connect 6th......................................to bus 6 7 8
Connect 7th......................................to bus 7 8 1
Connect 8th......................................to bus 8 1 2

Now, NOR all 8 outputs.....and there you have it!

Your bill is in the mail.

eric

5. ### autorelease Active Member

Jan 26, 2009
39
0
If you don't have to detect wrap-around (bits 7-8-1 and bits 8-1-2), then you could use 6 NAND gates. Then you could use two 74HC10's or 4023's.

The 4078 is an 8-input NOR gate.

This only works if you need to output high if there are at least three consecutive ones. If you need to detect the presence of exactly three consecutive ones, this won't work because of the NOR gate, and things get much more complicated...

6. ### KL7AJ AAC Fanatic!

Nov 4, 2008
2,043
292

Good point on the wraparound

I'm not sure it would be MUCH more complicated if we wanted to detect precisely three 1's. I think if you used EXCLUSIVE NOR gate, it would be taken care of. I'll have to think about this.

eric

7. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
Take another look at the original problem statement.

Any time there are three adjacent '1's with a zero on either side, the output should be true, else false.
Eric, your original solution won't work as is, because your three-input NANDS ignore the bits on either side of three adjacent bits.

The wrap-around question is a valid point too; but we need to hear from our OP on that question.
For example, would:
11101110
be considered true or false?

Last edited: Feb 19, 2009
8. ### hgmjr Moderator

Jan 28, 2005
9,030
214
Also it would ibe of nterest to have the OP to confirm whether the 8 bit pattern 00111100 would be true or false?

hgmjr

9. ### abuarab88 Thread Starter Member

Nov 6, 2008
19
0
yes it is considered true
and also this is considered true

and i will be gratefull if you supply me with the name and numbers of components i need to use and better a draw of the combination
cause i am too begginner

thank you all

10. ### hgmjr Moderator

Jan 28, 2005
9,030
214
This being the case, the approach outlined by KL7AJ should be a reasonable one.

hgmjr