MrTJP / ProjectRed

Redstone Engineering
MIT License
475 stars 184 forks source link

[Request][Logic Gate] Binary To BCD Converter #1347

Open DanHCraft opened 6 years ago

DanHCraft commented 6 years ago

Description

It should convert a 27-bit-number into an 8-digit-BCD-number. A boundled cable has all 16 colored channels in it with that you can provide an 16-bit binary number. Also you can provide 4 BCD-digits with one bundled cable, because one BCD-digit has 4 bits. My idea is that you have two inputs and two outputs each of it with boundled cables. It is also the perfect complement to the 7-sigment-display.

I/O Sides:

Largest Number that can displayed with that converter is 99.999.999 .

tomaspecl commented 5 years ago

Once I made a binary to BCD converter module with project red fabrication. I made it so you can chain them together kinda infinitely and with that you can have as many bits and digits as you want. It might be slower and harder to setup but in the end it is more flexible. I could send you a schematic of my design if you want.

equalssign003d commented 5 years ago

This feels like a very specific function. I think that somthing like an EEPROM or RAM (#1486) that can map any input to any output would be more useful because it could be used for a lot of different things, including this (but it would require two gates instead of one).

DanHCraft commented 4 years ago

Once I made a binary to BCD converter module with project red fabrication. I made it so you can chain them together kinda infinitely and with that you can have as many bits and digits as you want. It might be slower and harder to setup but in the end it is more flexible. I could send you a schematic of my design if you want.

I apologize for the late answer. Of cause I would like to have a schematic of your circuit implementaion of the bin2bcd converter. I thank you very much

(^-^)/

tomaspecl commented 4 years ago

Once I made a binary to BCD converter module with project red fabrication. I made it so you can chain them together kinda infinitely and with that you can have as many bits and digits as you want. It might be slower and harder to setup but in the end it is more flexible. I could send you a schematic of my design if you want.

I apologize for the late answer. Of cause I would like to have a schematic of your circuit implementaion of the bin2bcd converter. I thank you very much

(^-^)/

Wow I didnt think you whould answer after such a long time (I almost forgot that I posted something)!

It uses Double dabble algorithm: https://en.wikipedia.org/wiki/Double_dabble. I have attached some screenshots from the IC workbench. At the top of the schematic there is BCD output. At the bottom there is clock input. Left side is clocked output to next module. Right side is clocked input from previous module. There is currently no way of reseting the circuitry (setting to zero) other than clocking the clock input few times very fast (should be easy to fix).

2020-04-01_01 01 45 2020-04-01_01 01 23 2020-04-01_01 01 20 2020-04-01_01 00 22 2020-04-01_00 59 30 2020-04-01_00 59 15 2020-04-01_00 58 54 2020-04-01_00 58 32 2020-04-01_00 58 28 2020-04-01_00 58 23 2020-04-01_00 58 17

I have also included screenshots of my setup. The IC gate "16bit sreg pr" is shift register with paralel input from the bus input panel and serial input from the unconected side. The side connected to BINtoBCD unit is serial output. The side of the shift register connected to bundled cable is clock input [white] and input select [orange] (orange off means shifting in from serial input and shifting out from serial output on negative clock edge. When orange is on it latches input from paralel input on negative clock edge)

2020-04-01_01 27 08 2020-04-01_01 26 53

There is schematic of my shift register with paralel input:

2020-04-01_01 51 12 2020-04-01_01 50 39 2020-04-01_01 50 08 2020-04-01_01 48 46 2020-04-01_01 48 36

And also the level.dat file from my save folder-you can use something like NBTExplorer to look directly at my player inventory data (the only item in my inventory is schematic of my BIN2BCD module) and even transfer the data to some other world/inventory.

level.zip

If you have any problems tell me. Btw I am still playing on MC version 1.7.10. I hope you (or anybody else) finds this usefull.