Project Red - Expansion

Project Red - Expansion

31M Downloads

[Request][Logic Gate] Binary To BCD Converter

DanHCraft opened this issue ยท 4 comments

commented

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:

  • Input One: Bit 1-16
  • Input Two: Bit 17-27
  • Output One: BCD-digits 1-4
  • Output Two: BCD-digits 5-8

Channel Table

Color from the channel of the boundled cable INPUT 1 INPUT 2 OUTPUT 1 OUTPUT 2
white Bit 1 Bit 17 BCD 1 Bit 1 BCD 5 Bit 1
orange Bit 2 Bit 18 BCD 1 Bit 2 BCD 5 Bit 2
magenta Bit 3 Bit 19 BCD 1 Bit 3 BCD 5 Bit 3
light blue Bit 4 Bit 20 BCD 1 Bit 4 BCD 5 Bit 4
yellow Bit 5 Bit 21 BCD 2 Bit 1 BCD 6 Bit 1
lime green Bit 6 Bit 22 BCD 2 Bit 2 BCD 6 Bit 2
pink Bit 7 Bit 23 BCD 2 Bit 3 BCD 6 Bit 3
gray Bit 8 Bit 24 BCD 2 Bit 4 BCD 6 Bit 4
light gray Bit 9 Bit 25 BCD 3 Bit 1 BCD 7 Bit 1
cyan Bit 10 Bit 26 BCD 3 Bit 2 BCD 7 Bit 2
purple Bit 11 Bit 27 BCD 3 Bit 3 BCD 7 Bit 3
blue Bit 12 Bit Free BCD 3 Bit 4 BCD 7 Bit 4
brown Bit 13 Bit Free BCD 4 Bit 1 BCD 8 Bit 1
green Bit 14 Bit Free BCD 4 Bit 2 BCD 8 Bit 2
red Bit 15 Bit Free BCD 4 Bit 3 BCD 8 Bit 3
black Bit 16 Bit Free BCD 4 Bit 4 BCD 8 Bit 4

Largest Number that can displayed with that converter is 99.999.999 .

commented

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).

commented

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.

commented

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

(^-^)/

commented

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.