# I need help in Digital logic Design?

#### chris012

Joined Feb 4, 2021
4
Hi, I need help in DLD. I want to you to help me in digital numbers. Kindly if you know any shortest way to convert decimal into binary numbers. If you have any formulas for conversions kindly share with me.

#### jpanhalt

Joined Jan 18, 2008
11,087
Welcome to AAC, Chris.

There are lots of ways to convert decimal to binary. Please start by defining:
1) How many decimal digits do you need to convert?
2) Do you want algorithms or do you want the code to do it?

Here's one of several methods: https://www.electro-tech-online.com...th-numbers-larger-than-32-bits-solved.160721/

And here's a link with several methods: http://www.piclist.com/techref/microchip/math/radix/index.htm

#### ericgibbs

Joined Jan 29, 2010
19,107
hi Chris,
Do want to do the Deci to Bin conversion in hardware or software.
You say DLD, so a HW solution would be to clock a Binary counter with a Deci clock.

If SW , which programming language and MCU.?
E

#### chris012

Joined Feb 4, 2021
4
Both in hardware and software
hi Chris,
Do want to do the Deci to Bin conversion in hardware or software.
You say DLD, so a HW solution would be to clock a Binary counter with a Deci clock.

If SW , which programming language and MCU.?
E

#### ericgibbs

Joined Jan 29, 2010
19,107
hi chris,
If SW , which programming language and MCU.?

We need more information in order to give a meaningful answer.
E

#### jpanhalt

Joined Jan 18, 2008
11,087
Same here, except when writing code. Then I let the Assembler do it for me.

Several years ago, Sharp EL-531X* were on sale at a local store for something like 2 for \$10. So, of course, I bought two. Quite useful when I am bit banging.

*It has conversions for bin, oct, hex, and dec plus the usual logic operators (NOT, AND, OR, XOR, and XNOR) .

#### crutschow

Joined Mar 14, 2008
34,842
It can be done all in hardware if you like.
One way is to load the binary word into a binary down-counter and have it count down to zero.
There is also a decimal up-counter that counts up with the same clock for the same number of counts.
You then have the decimal (BCD) output of the binary word at the end of the count.

This is not very fast, especially for larger numbers, but it's generally adequate if the BCD number goes to a visual display.

Edit: I see the TS wants decimal to binary. For that just make the BCD counter the input with the binary counter being the output

Last edited:

#### MrChips

Joined Oct 2, 2009
31,083
There are four combinations.

1) SW decimal to binary
2) SW binary to decimal
3) HW decimal to binary
4) HW binary to decimal

Choose one to start.

#### jpanhalt

Joined Jan 18, 2008
11,087
While the TS asks specifically about decimal to binary, the title is not so restrictive. Digital and binary are not the same. Awhile back, I saved an interesting piece on using decimal math without conversion to binary.

https://www.sciencedirect.com/science/article/pii/S0895717709001496 (2008)
(Abstract)
Since radix-10 arithmetic has been gaining renewed importance over the last few years,
high performance decimal systems and techniques are highly demanded. <snip> The algorithm works with BCD operands
and no conversion to binary is needed.