|
Some time ago, I don't remember just when, I came up with the Chop Suey Machine which works as follows: Start with a set of memory locations (any size will do). Add the first value to the second one and store it in the second one. Now take the result and add it to the third one and store it there. Continue for as many locations as you like. Finally, add to the 1st byte and swap nibbles. A three byte implementation in PIC code looks like this.... An initial state of zero's in all locations results in zero's being output. Seed at least one location with a non zero value to start. Adding additional locations greatly increases the length of the series while adding very little overhead (2 instructions each). There is no guarantee of producing a maximum length sequence with this little hack. You can't even guarantee the sequence length. Like may random generators, sequence length may depend on the initial values. |
| |