# Will my decimal to binary converter work

I got into electronics recently and I hope to make a 8 bit ripple carry adder with a decimal input and output.

This input is the first schematic I designed from scratch without a tutorial to go off of and I was wondering if it would work and further, if anyone had any improvements that could be made.

If there's anything wrong with my schematic please comment and I will fix it as fast as possible

Thanks again, stackexchange has been invaluble for my learning electronics

*Edit

A0:  800s
A1:   80s
A2:    8s
A3:  400s
A4:   40s
A5:    4s
A6:  200s
A7:   20s
A8:    2s
A9:  100s
A10:  10s
A11:   1s


and then a binary output

*edit 2, I'm testing the circuit and the clock on a shift register doesn't seem like it can be advanced with a button. Any thoughts?

*edit 3, here's how the switches I'm using work in case that helps

• Where are your equations? – Ignacio Vazquez-Abrams Apr 2 '18 at 20:44
• adding them now – Patrick McCarthy Apr 2 '18 at 20:48
• What is ‘s’? Do you possibly mean ‘h’? – C_Elegans Apr 2 '18 at 20:53
• @C_Elegans I suspect it is "plural." So "100s" reads as "hundreds?" – jonk Apr 2 '18 at 20:55
• Of course, it might also mean the usual $s=\sigma+j\:\omega$, too. ;) – jonk Apr 2 '18 at 20:56

## 2 Answers

This has, well, it has a whole bunch of problems. I'm not sure if I can cover them all.

1) You are using diode logic. Fine. However, you need pulldown resistors (1k to 10k) at each input. That includes ST/CP. If you don't do that, an undriven input will not be guaranteed to be at any particular voltage, at least not for HC logic.

2) Your E0 switch is not connected to any input except ST/CP. Assuming you want this to be a "200", it will, instead, introduce a zero while at the same time shifting everything.

3) You only have 10 inputs. This only allows inputs from 0 to 399, assuming BCD input. Or do you want a binary input? You only have 8 outputs. This will only allow a maximum display of 0 - 299. To display ANY number from 0 - 999 (which I think is what you want, but you haven't stated this clearly), you need 12 LEDs.

4) You have not debounced your inputs. Think about how a switch works. You press a button and two pieces of metal are pushed together. What you don't realize is that, depending on switch construction, it's entirely possible that the two contacts will physically bounce apart when they first hit each other. They may even bounce repeatedly. If this happens, the switch will open and close several times over a period of microseconds to milliseconds, and the 595 may well detect some of those repeats.

5) At the same time, since the logic works so fast, details of wiring may cause some inputs to respond faster than others. This means that it's possible that for a particular switch closing, the ST/CP may activate a few nsec before the input goes high, and this will cause the 595 to act as if it has been activated with a zero input. Not good.

6) You have left many inputs floating. The very first rule of CMOS logic is: Thou Shalt Not Leave Inputs Floating. ALL inputs must be tied high or low. If you don't do this, you will get the most amazing problems.

7) MR has not been connected anywhere. As a result, when you turn on power, the outputs can be in any state they want, rather than the all-zeros I think you're expecting.

8) SH/CP is not connected anywhere. This is the clock which transfers the internal shift register to the outputs. If you don't drive an edge to this, the outputs will never change.

9) Those are the little things. Apparently, you want every push of a button to add the button's value, and that is just not going to happen. Serial shifts are not the same as addition. Let's take your E9 as an example. I assume that it is supposed to represent 1. Assume that the outputs are at 0. so the output of U4 is 000. Pushing E9 (assuming objections 1,4,5,6,and 8 have been addressed) will produce 100, which is 1. Another push will produce 110, which is 11, and another push will produce 111, which is 111. Similar issues exist for all the other buttons as well.

So the short version is that this just won't work, for reasons large and small.

EDIT - Your clock problems can be dealt with fairly simply. Use something like

simulate this circuit – Schematic created using CircuitLab

The first RC network will give about a 5 msec delay, which will (hopefully) allow switch bounce to settle out, and the second will give a similar delay before updating the output. Note that you MUST use a Schmitt trigger if you want clean clock edges.

The MR problem is similarly easy.

simulate this circuit

This is called a Power On Reset (POR) circuit. When power is applied, the capacitor is at low voltage, so the MR is low. After the capacitor charges up, the MR goes high. The diode speeds up discharge when the power turns off and helps protect the inverter. Again, the inverter MUST be a Schmitt trigger.

In thinking about it, objection 9 is wrong. Sorry. Yes, you can do it this way, but be aware that coming up with your EPROM map may be a real pain.

The way you've done it, you can only handle 3 successive button pushes. Furthermore, you'll need to very careful about out-of-bound error checking. Your maximum input is 100. Do this 3 times and you'll get a sum of 300, which is more than the 255 which an 8-bit binary can express.

And this is not, technically, a ripple adder. No addition (in the usual sense) is being performed - simply a look-up over several inputs.

• Thanks for your help, I'm going to address this point by point so I can clarify. 1) Fixed 2) I don't understand 3) It's being outputted to a 8 bit ripple adder so I only need numbers 0-255 4) I'm using Cherry MX mechanical keyboard switches so I didn't think that'd be a problem but I'll fix it 5) I'm trying to figure out a way to delay the clock input 20 nanoseconds because that's the timing it says on the 595's datasheet but I haven't come up with anything. 6) Fixed 7) how would you propose I connect that? 8) Fixed 9) E1 represents 1, E2 2 and so on. – Patrick McCarthy Apr 3 '18 at 16:25
• Ran out of characters, sorry. 9) I think that should work because 9 goes to the 8 button and the 1 button so 8+1=9 and the first clock cycle if 9 is pressed my eeprom recognises that as 900 second clock cycle it would recognise it as 90 and third clock cycle as 9 so I don't see the problem but if you could explain it that'd be great. Thanks for your help and sorry for my ignorance – Patrick McCarthy Apr 3 '18 at 16:27
• @PatrickMcCarthy - See edit. – WhatRoughBeast Apr 4 '18 at 19:12
• Thanks for the clarification, the master reset is active low so do I still need the inverter? The reason I mentioned the ripple adder is because the output of this circuit is feeding into the input of a second circuit with a ripple adder. – Patrick McCarthy Apr 4 '18 at 19:57
• @PatrickMcCarthy - Good catch on the reset polarity. In that case it needs a second inverter, just as with the clock circuits. I've edited the schematic to reflect this. – WhatRoughBeast Apr 4 '18 at 21:25

Good night!

You can use software to simulate your designs like Proteus (https://www.labcenter.com/) or (https://logic.ly/) or (https://ds0.me/csim/). In the web there are a lot of them you can choose the one you want, it depends on you. Some of the software are free another have a free trial and the other we have to pay.

About your design, you could simplify all that diodes using logic gates and Boolean algebra (ie. Circuit minimization, Karnaugh maps, Quine–McCluskey algorithm) (https://www.allaboutcircuits.com/textbook/digital/chpt-8/karnaugh-maps-truth-tables-boolean-expressions/).

Also, remember secure GND to avoid parasitic currents in all your switches, but in your design you must secure GND in ST/CP across a resistor that could be 2Kohm.

If you need to mount that on a breadboard remember to buy a good breadboard with a solid base and a good wire to connect the ICs, sometimes it could be a little tricky.

• But the question is "Will my decimal to binary converter work?". I don't think you have answered that. – Transistor Apr 3 '18 at 17:04