Binary Decoder
Binary Decoder
Ive been looking at all the binary decoders, but not a single one has shown fully what they have done? Ive seen a design with two constants, and an arithmetic, but they dont show the second constant or the arithmetic. Im not sure if it still works, but I would like to know what is in the arithmetic and constant. - Endus322
Re: Binary Decoder
The constants are 2^n, the arithmetic is EACH * Input. The result is negative numbers for 1, and positive numbers for 0.
Re: Binary Decoder
so one constant is set to my binary number, what do i set as n. Arithmetic is set to each * blue (blue is binary number), what item do i do for the 2^nDaveMcW wrote:The constants are 2^n, the arithmetic is EACH * Input. The result is negative numbers for 1, and positive numbers for 0.
Edit: Do i set the lamps to = 1,2,4,8,16,32 ect, and start from the right side?
Re: Binary Decoder
You need 32 constants, from 2^0 to 2^31.
-
- Manual Inserter
- Posts: 2
- Joined: Wed Aug 23, 2023 8:55 pm
- Contact:
Re: Binary Decoder
These topics give me the same confusion. This is some help, but still. Is one constant the "target number" and the other the "2^n" constants? like actually typed out, 0, 1, 2, 4, the rest. Do they all have to be the same signal?
Working blueprint or picture with details much appreciated.
Working blueprint or picture with details much appreciated.
Re: Binary Decoder
Hm, what exactly do you want to achieve? Which problem do you want to solve?
In general:
To set a single bit in a signal, you have to do a bitwise OR with the appropriate number (meaning 1,2,4,8,etc. - it has to be 2^n)
To check if a bit is set, you have to do a bitwise AND with that number.
StilI it's important to know what you want to actually do. I use a bitwise signal to activate target stations for my recycling train based on the trains content, for example. But my solution might not work for you at all.
In general:
To set a single bit in a signal, you have to do a bitwise OR with the appropriate number (meaning 1,2,4,8,etc. - it has to be 2^n)
To check if a bit is set, you have to do a bitwise AND with that number.
StilI it's important to know what you want to actually do. I use a bitwise signal to activate target stations for my recycling train based on the trains content, for example. But my solution might not work for you at all.