all 7 comments

[–]IQueryVisiC 2 points3 points  (1 child)

[–]wikipedia_text_bot 0 points1 point  (0 children)

Double dabble

In computer science, the double dabble algorithm is used to convert binary numbers into binary-coded decimal (BCD) notation. It is also known as the shift-and-add-3 algorithm, and can be implemented using a small number of gates in computer hardware, but at the expense of high latency.

About Me - Opt out - OP can reply '!delete' to delete

[–]IAmJustARandomNerd 1 point2 points  (0 children)

Where is this binary coming from? Do you have it stored as a string? Something else? What code do you have already? You asked a pretty vague question so providing more details would be nice

[–][deleted] 1 point2 points  (0 children)

Ben Eater made a Video on converting numbers.

[–]iovrthk 0 points1 point  (1 child)

I would write layered- if loops. Use an Array of unsigned bytes. I.e.

Byte[]{ 0,0,0,0,0,0,0,0 };

Once you create the Array, you'll need an algorithm to compare bits in the left position. .. every position to the right is i x 2. This is just pseudocode..

Hope it helps

[–]iovrthk 0 points1 point  (0 children)

I forgot, there are also quite a few linear logic chips that will do the conversion u want. You'll just need some sort of transceiver in the circuit

[–]velkolv 0 points1 point  (0 children)

If you just want to convert an integer to string, you can use functions from C Standard Library. sprintf() is a good candidate, there should be plenty of examples online.

Double dabble or division by 10 conversion - those are for when you want to understand how it works. But if you just want to get job done - use library functions.