We all know how to convert binary to analog. It is simply subtracting/adding the values 8,4,2, and 1 to a line of comparators.
When it comes to converting analog to binary, it is a bit more difficult.
There are two kinds of conversion that I know of:
1. get a single output from the analog and then decode it from there.
or
2. Logically process the analog signal.
I'll try to go over both.
Table Decoder
This design is big, but is easy to understand and also easy to sync the outputs.
First you need some kind of analog selector. This takes the analog signal and gives a single output among 15 lines.
Second you need to hook up a decoder to the selector. depending on the output of the selector, the decoder will display the correct binary value which you have laid out(normally with torches).
Logic Decoder
This design involves using the compare and subtract functions of the comparator to get the desired result. It can be confusing but once you get it, it makes a lot of sense.
There are 2 lines of comparators in this: a logic line, and a bypass line.
First, you take the incoming signal and compare it to a value of 8. If its less than 8, the signal will be ignored and pass through the bypass comparator. If its 8 or more, it will pass through that comparator and make some things happen. It disables the bypass, displays a 1 in the 8s place, and sends the signal on through a comparator to subtract 8.
The logic line is then reconnected with the bypass line and the process is repeated with values 4 and 2.
After all 3 processes, the only possible leftover is 1, so you don't need to have a process for that. Just combine the lines after the 2 process , put a repeater on it, and there's your 1s place.
Here's a block diagram I drew up in autocad for reference.
You can also subtract from the bypass instead of having a separate comparator to subtract from.
I hope this is informative. I know analog isn't very popular here but its my favorite subject in redstone.
When it comes to converting analog to binary, it is a bit more difficult.
There are two kinds of conversion that I know of:
1. get a single output from the analog and then decode it from there.
or
2. Logically process the analog signal.
I'll try to go over both.
Table Decoder
This design is big, but is easy to understand and also easy to sync the outputs.
First you need some kind of analog selector. This takes the analog signal and gives a single output among 15 lines.
Second you need to hook up a decoder to the selector. depending on the output of the selector, the decoder will display the correct binary value which you have laid out(normally with torches).
Logic Decoder
This design involves using the compare and subtract functions of the comparator to get the desired result. It can be confusing but once you get it, it makes a lot of sense.
There are 2 lines of comparators in this: a logic line, and a bypass line.
First, you take the incoming signal and compare it to a value of 8. If its less than 8, the signal will be ignored and pass through the bypass comparator. If its 8 or more, it will pass through that comparator and make some things happen. It disables the bypass, displays a 1 in the 8s place, and sends the signal on through a comparator to subtract 8.
The logic line is then reconnected with the bypass line and the process is repeated with values 4 and 2.
After all 3 processes, the only possible leftover is 1, so you don't need to have a process for that. Just combine the lines after the 2 process , put a repeater on it, and there's your 1s place.
Here's a block diagram I drew up in autocad for reference.
You can also subtract from the bypass instead of having a separate comparator to subtract from.
I hope this is informative. I know analog isn't very popular here but its my favorite subject in redstone.