At 09:54 PM 10/11/2004, Martin McCormick wrote: > I have heard of shift registers being used along with feedback >to generate a pseudo-random bit pattern. A PIC would be excellent for >setting up such a scheme because any two or three bytes can be shifted >left or right and ganged in to a shift register so that a bit at one >end marches through the register and ends up at the other end. How >does the feedback loop work to scramble the bits so that the output at >least appears random? Someone mentioned my AVR code that does this, easily adaptable to the PIC. > If the bits in the shift register start out as all high or all >low, will that prevent the entropy from starting? In the project I am >thinking of, even the apparence of randomness is good enough. The only thing you can't do with a maximal length generator, is to start it with all zeroes. That's a "stuck" state. Anything else you load in will be fine. That means that an N bit register can only generate (2^N)-1 conditions, but you can always make the PN gen longer, and then take some bits out of the middle, and those will generate all 256 possible states with equal distribution. _______________________________________________ http://www.piclist.com View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist