On Tue, 2004-11-23 at 13:51 +0800, Chen Xiao Fan wrote: > Hi all, > > I am thinking of using a simple method to generate a series of > pseudo random code for the PIC12F629 (eg, 8 bytes, each within > 0 to 15) for sensor mutual interference immunity. > > One method is to use the serial number (SQTP) as the randomize seed. > Then we will need some ICSP program to dynamically change the > hex file. The serial number may reside in a fixed position > (eg. somewhere near the end of the Flash) in the firmware or > may be the ID Locations (up to 4 bytes). > > Some of the programmers may not support SQTP (Serialised Quick Turn > Programming). So I am thinking of using the OSCCAL as the random > seed. I checked several 12F629 and 12F675 and found that the > OSCCAL may be okay to use. They all look like '34xx' to me and > the last two bytes are quite different. > > Any other suggestions? Only problem I see with your suggestion is that the same device will over get the same seed, which means on every powerup the part will output the same sequence. Doesn't sound very pseudo random to me. Any way you can use the ADC or comparator as a source for random numbers? What about user input? What kind of inputs is the PIC seeing. Something like the time between button presses is generally quite a good source of "random". TTYL ----------------------------- Herbert's PIC Stuff: http://repatch.dyndns.org:8383/pic_stuff/ _______________________________________________ http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist