Forums - Open Redstone Engineers
Binary to Analog Decimal using Double-Dabble - Printable Version

+- Forums - Open Redstone Engineers (https://forum.openredstone.org)
+-- Forum: ORE General (https://forum.openredstone.org/forum-39.html)
+--- Forum: Projects & Inventions (https://forum.openredstone.org/forum-19.html)
+---- Forum: In Progress (https://forum.openredstone.org/forum-20.html)
+---- Thread: Binary to Analog Decimal using Double-Dabble (/thread-5419.html)



Binary to Analog Decimal using Double-Dabble - Legofreak - 12-29-2014

So earlier tonight I was trying to understand the Double-Dabble algorithm. It didn't really make sense at first... still doesnt really... but this thing works so far.
[Image: BinarytoACD_zpsa7bd9fa1.png]

It consists of 2 kinds of modules: A "shift" module and a "+3 if >4" module
8 is the carry in of the first shift module.
4 is the carry in of the second shift module.
2 is 3rd and so on...

The "shift" module is actually just subtracting the same number twice from 15 and getting its compliment, essentially multiplying by 2. Then there is some carry logic for future output digits.

The other one kinda explains itself. Add 3 if greater than 4. No carry logic needed apparently.

The logic is flat(2 tall) and with the input wires its only 4 blocks tall. I think it can stack 6 blocks wide but I might expand to 8 for input wire spacing.

I think its something like 36 ticks from 8's input to the output.

Only step to get to BCD now is an analog to binary decoder slapped onto each output.

Edit: Since I dont have MC here at work, I felt like making block diagrams in autocad to help explain the logic.
[Image: ShiftModule_zps6d0a5dfc.png]
I should rename Cin and Cout to Shift in and Shift out.
[Image: Add3Module_zps13967050.png]

[Image: hexbcd1_zps77e921a8.png]


RE: Binary to Analog Decimal using Double-Dabble - Apocryphan - 12-29-2014

i like it, i was looking at newo's video about double dabble a while ago and thought about making something like that.


RE: Binary to Analog Decimal using Double-Dabble - Chibill - 12-29-2014

So now I have a fast way to get to acd.


RE: Binary to Analog Decimal using Double-Dabble - Legofreak - 12-29-2014

Is this faster than what you have made? I don't think I've seen any of your ACD stuff that you talk about.


RE: Binary to Analog Decimal using Double-Dabble - Chibill - 12-29-2014

Mines a basic touch powered binary to Anolog


RE: Binary to Analog Decimal using Double-Dabble - Legofreak - 12-30-2014

I was able to stack it. 8 bit now. Works like a charm. I'm so surprised.

[Image: 8bitBINtoACD_zps244c465b.png]


RE: Binary to Analog Decimal using Double-Dabble - newomaster - 01-01-2015

I thought about doing something like this a while back but school started and I never really got around to it. Glad to see someone gave it a go. Another thing you may want to try is have analog hex input and analog decimal output somehow and then figure out how to condense the conversion from there - there's probably some interesting conversion algorithms you could derive using hexadecimal instead of straight up binary.


RE: Binary to Analog Decimal using Double-Dabble - Legofreak - 01-01-2015

(01-01-2015, 09:37 AM)newomaster Wrote: I thought about doing something like this a while back but school started and I never really got around to it. Glad to see someone gave it a go. Another thing you may want to try is have analog hex input and analog decimal output somehow and then figure out how to condense the conversion from there - there's probably some interesting conversion algorithms you could derive using hexadecimal instead of straight up binary.


I was hoping double dabble would let me do that, but after I finished a cell and started stacking, I realized that the input always goes into the Cin.

I googled for hex to dec conversion but the algorithms I found involve multiplication in dec. I havent quite figured out the best way to do that yet.

So the only way I can think to do that right now is just throw some hex to bin decoders in the inputs... but thats a really slow cop-out.

So far, I've gotten each double cell down to 7 ticks. I combined the 2 so there would only be 2 inversions instead of 4.

Also, at least it seems like I dont need the first 3 shifts since it wont add 3 until there are 3 bits.


RE: Binary to Analog Decimal using Double-Dabble - Apocryphan - 01-02-2015

Would it be a cop out to use a rom instead of a multiplier and then just add the first hex digit? That's the easiest way I can think of right now.


RE: Binary to Analog Decimal using Double-Dabble - Apocryphan - 01-02-2015

[Image: 7c7i24S.png]

The first hex value is easy to convert to decimal, the 2nd i noticed some patterns but im not sure how to manipulate it to get the right output.

[Image: nLm8UxS.png]

Far left hopper is the input. the first digit repeats after 5 so i adjust it to 1-5. The tens digit seems like a similar pattern every 5, but subtracted by 2 or even shifting diagnolly there is a pattern. the increments go up by +1 +2 +1 +2 +2. Not sure how i should go about doing it, any input would be awesome.

ten's digit
1-5 1 3 4 6 8
6-10 9 1 2 4 6
11-15 7 9 0 2 4


Edit: I threw a rom on the 2nd digit, and it works for the 2nd hex value, so this works as a hex multiplier. i just need to make it add the 1st value and carry when necessary.

[Image: 6f0SWrK.png]


RE: Binary to Analog Decimal using Double-Dabble - Legofreak - 01-02-2015

Depending on how it works, a ROM might be the fastest option for analog. the thing is, I'm looking for an algorithm...

I'm looking to get up to 4 hex digits or 16 bits. currently my double dabble thing should be able to stack that far but it will be huge...


RE: Binary to Analog Decimal using Double-Dabble - Legofreak - 01-04-2015

The advantage of flat stuff is that you can fold it on top of itself pretty easily. this has 2X stacked vertical binary inputs

I feel like this is pretty compact for 8 bit conversion(24x12x16). I even slapped on a couple of the magical gentleman's vertical hex to bin converters on the inputs. I even added a 9th bit(256) just because it didn't require anything extra. this was a bit of a speed build with not much optimization in mind.
[Image: HEXtoACD_zpsa601c988.png]

didnt bother deleting the extra cells. so the top left half doesn't actually do anything.

edit: tested functional to 16 bit or FFFF in hex
[Image: HEXtoACD16bit_zps3f571802.png]

It's a big triangle when the useless cells are taken away
[Image: HEXtoACD16bit2_zps8ab69278.png]

I also made leading 0s disable the display


RE: Binary to Analog Decimal using Double-Dabble - Frontrider - 01-23-2015

Newomaster made some really small binary to hex analog / hex analog to binary converters. Thats a rellay big help. You can have trouble extending it to connect the display.


RE: Binary to Analog Decimal using Double-Dabble - Legofreak - 01-23-2015

the vertical white parts on the side are hex to binary. The output of the acacia wood device is analog decimal. If I wanted BCD I would just need another hex to binary converter for each output digit. So I wouldnt actually need binary to hex anywhere in here. Binary to hex is super easy too. Thanks anyway.


RE: Binary to Analog Decimal using Double-Dabble - Magic :^) - 01-24-2015

my hex->bin decoder!
Big Grin

This topic makes me want to brush up on my display skills, the stuff i use right now is horrifically large ;-;

Nice work with the double dabble!


RE: Binary to Analog Decimal using Double-Dabble - Legofreak - 01-24-2015

Yes, I love them. They fit perfectly for this design. I didn't feel like designing a new one. sorry i didnt ask, but at least i give credit Tongue


RE: Binary to Analog Decimal using Double-Dabble - Frontrider - 01-24-2015

You really need double dabble to do that? If everything goes right i will present my solution in a few hours in my application.
Right after i filled the communication gap between me, and the guys guiding/ whatching my application.


RE: Binary to Analog Decimal using Double-Dabble - Magic :^) - 01-24-2015

It's on, bois

[Image: 5Ng57KB.gif]


RE: Binary to Analog Decimal using Double-Dabble - Legofreak - 01-24-2015

There is a way to convert hex directly to decimal but it involves multiplying powers of 16 by the amount of each digit... I haven't quite figured out a good way to do that yet.


RE: Binary to Analog Decimal using Double-Dabble - Nuuppanaani - 01-25-2015

(01-24-2015, 12:27 PM)The Magical Gentleman Wrote: It's on, bois

[Image: EsgyUmj.gif]


RE: Binary to Analog Decimal using Double-Dabble - Frontrider - 02-11-2015

(01-24-2015, 05:26 PM)RekcirBrickeR Wrote: There is a way to convert hex directly to decimal but it involves multiplying powers of 16 by the amount of each digit... I haven't quite figured out a good way to do that yet.

Theres must be some cheaty way to bypass it. I think i might got somewhat closer, but its also could be a dead end.
I'm trying octal to decimal, since that way i can have a gap to use.