viewtopic.php?f=193&t=29444
I wondered if it was possible to extend the shift register idea to beyond 32 bits. So I came up with this:
WARNING. FLASHING LIGHTS
On each circuit network cycle each color signal is being shifted up one bit. The pattern could be anything:
WARNING. EVEN MORE FLASHING LIGHTS
The signals being shifted could be any signals (or even EVERY SINGLE signal). I only chose color signals here so they could be fed directly to lamps.The display part might also be interesting on it's own. Each lamp is controllable by a single bit of a signal. It's seems scalable to many more signals without increasing the amount of combinators too much. Certainly something I will investigate in the future.
Blueprint: Input is the sole constant combinator (A in screenshot), turn it on/off to add low bits to the red signal.
The bit shifting part is accomplished by a single Arithmetic Combinator (B in screenshot): When the highest bit of a certain color is set, then the lowest bit of the next color will be set on the next cycle. This is done with six Decider Combinators (C in screenshot): Then when the highest bit of the last color is set, then the lowest bit of the first color will be set on the next cycle. This results in the looping behavior (D in screenshot): Removing that last decider combinator or turning it's output off will result in the the register emptying itself out after a few seconds.
The rest of the combinators are basically to prepare the signals so the lights turn on/off as intended. Each lamp is configured to turn on when any bit higher than certain position is set (E in screenshot): That patterns continues until the last light which turns on only when bit position 31 is set. Each row of lamps uses each own color.
There's three problems with the setup at this point:
- Lamps don't just take the color which is set in the condition, they take the first color signal they can find (red if found, then green if found, etc)
- Bits get shifted into the sign bit, resulting in negative values. Lamps will turn off with any negative value.
- Lamps will remain on when any bit higher than their condition is set
The third problem was solved by subtracting the upper bits from the input to the lamps. This was done with two Arithmetic combiners for each column of lamps (H in screenshot): Dividing and then multiplying by a power of 2 clears the lower bits of the value. Since the multiplication is by a negative value the result is negative. Then that signal is connected into the lamps, effectively clearing the higher bits of the signal the lamps receive, since lamps already receive the normal value via green cable:
all_bits - high_bits = low_bits
And one last problem is that the green and red cable signals going into the lamps are not synchronized. The green wire goes thru a single Decider combinator while the red wire signal goes thru two Arithmetic combinators. So a delay Decider combiner (I in screenshot) was added to the other green wire path, just to keep signal sync.