Author |
Message |
commathe

Joined: Jul 26, 2013 Posts: 153 Location: Beijing
Audio files: 5
|
Posted: Tue Sep 09, 2014 10:49 pm Post subject:
Can anyone figure out how to make this circuit? |
 |
|
I want something that can take in some number of logic highs and output how many there are as a binary number.
Lets say I have 4 separate 1-bit inputs. I want to convert this two a two-bit binary output. If all four inputs are high, then I want to put out 11, if three are high then output 10, if two are high 01, if none are high 00.
Here's where I am getting really stuck though: it needs to be able to do it no matter which inputs are high or low. ANY two inputs have to make it put out 01. ANY 1 input results in 01 out. |
|
Back to top
|
|
 |
synaesthesia

Joined: May 27, 2014 Posts: 291 Location: Germany
Audio files: 85
|
Posted: Wed Sep 10, 2014 12:13 am Post subject:
|
 |
|
You could do it straight forward and calculate the terms for the two binary output digits you want. This will likely result in a rather complex circuit with lots of gates.
However, instead of using logic gates you could try to break the two boolean functions down into terms with only two inputs and use 4052 chips to implement it FPGA style. The analog mux inputs could be hard-wired to Vdd/Vss to implement the truth table and the two inputs select the output from it.
Another approach is to do it the analog way. Add the input bits with a resistor network and evaluate the resulting output voltage using comparators.
From your description it is not clear to me what exactly the output should be. There are 0 to 4 HIGHs possible, but with two binary digits you can only represent the numbers 0 to 3. If you can describe what you intend to do with that function, there may be more ideas. |
|
Back to top
|
|
 |
commathe

Joined: Jul 26, 2013 Posts: 153 Location: Beijing
Audio files: 5
|
Posted: Wed Sep 10, 2014 12:28 am Post subject:
|
 |
|
synaesthesia wrote: | Another approach is to do it the analog way. Add the input bits with a resistor network and evaluate the resulting output voltage using comparators. | Yes! Can't believe I didn't think of this! I could just use a summing amp and a few window comparators!
I'm trying to make a sequencer that "adds" together square waves that will make up the rhythym. I have a sequencer that is just a mux so I wanted an output compatible with that.
Ironically I already did the comparator to digital method for another module. Its funny how set you can be on thinking a different problem must have a different answer when often there are a few very useful answers that solve a wide range of problems. |
|
Back to top
|
|
 |
PHOBoS

Joined: Jan 14, 2010 Posts: 5868 Location: Moon Base
Audio files: 709
|
Posted: Wed Sep 10, 2014 5:57 am Post subject:
Re: Can anyone figure out how to make this circuit? |
 |
|
commathe wrote: | Lets say I have 4 separate 1-bit inputs. I want to convert this two a two-bit binary output. If all four inputs are high, then I want to put out 11, if three are high then output 10, if two are high 01, if none are high 00. |
that would give:
DCBA - XY
----------
0000 - 00
0001
0010
0011 - 01
0100
0101 - 01
0110 - 01
0111 - 10
1000
1001 - 01
1010 - 01
1011 - 10
1100 - 01
1101 - 10
1110 - 10
1111 - 11
what should the output be if only 1 input is high ? _________________ "My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube |
|
Back to top
|
|
 |
synaesthesia

Joined: May 27, 2014 Posts: 291 Location: Germany
Audio files: 85
|
|
Back to top
|
|
 |
commathe

Joined: Jul 26, 2013 Posts: 153 Location: Beijing
Audio files: 5
|
Posted: Wed Sep 10, 2014 6:58 pm Post subject:
Re: Can anyone figure out how to make this circuit? |
 |
|
PHOBoS wrote: | what should the output be if only 1 input is high ? | I was silly and thought "2 bits = 4 values, thus: 2 bits = 1-4" when two bits would only handle three inputs.
Reminds me of a joke:
Q: How do you know someone is a programmer?
A: They start counting from 0
I have never looked into the 4067 before, but I'm going to have to pick up a few now! |
|
Back to top
|
|
 |
RingMad

Joined: Jan 15, 2011 Posts: 428 Location: Montreal, Canada
Audio files: 4
|
Posted: Thu Sep 11, 2014 11:54 am Post subject:
|
 |
|
Nothing useful to say about the circuit, but just an old classic joke to add...
There are 10 types of people in the world: Those who understand binary, and those who don't...
James. |
|
Back to top
|
|
 |
Cynosure
Site Admin

Joined: Dec 11, 2010 Posts: 1011 Location: Toronto, Ontario - Canada
Audio files: 82
|
Posted: Sat Sep 13, 2014 9:06 am Post subject:
|
 |
|
Use an lm3914 for your comparators. Then you can have 2 modes of opteration by switching between the line and dot display modes. |
|
Back to top
|
|
 |
commathe

Joined: Jul 26, 2013 Posts: 153 Location: Beijing
Audio files: 5
|
Posted: Sun Sep 14, 2014 12:25 pm Post subject:
|
 |
|
Cynosure wrote: | Use an lm3914 for your comparators. Then you can have 2 modes of opteration by switching between the line and dot display modes. | Good call! I have a bunch of spares kicking around! |
|
Back to top
|
|
 |
|