Sounds like a good idea. I will experiment it. Thanks. ----- Original Message ----- From: "Mike Harrison" To: Sent: Thursday, August 16, 2001 6:11 PM Subject: Re: [PIC]: Generating a "truly" random number on the application of power I think the best bet would be to time the WDT period against the crystal/resonator, as this will vary slightly from part to part and with voltage and temperature. Using TMR0, you can measure the period to 1uS at 4MHz, i.e. about 0.005% of the nominal WDT period - it is reasonable to assume that WDT periods will not be matched to this degree. I'd do it like this : On reset : Check STATUS to determine if reset was power-up or WDT: If Power-up : Set TMR0 to internal clock, no prescale. Allow WDT to time out. If WDT timeout : TMR0 should contain a fairly random value, at least in the lowest few bits. If you want more randomness, increase the WDT prescaler setting, to measure a longer measurement period. The TMR0 register may also have initialised randomly as well, which will help. On Tue, 14 Aug 2001 13:17:59 -0400, you wrote: >Hi, > >In our project, several identical boards are connected together. Normally, >on the application of power, they will be turned on at the same time and >starting running at the same time. But we don't want that to happen. If all >boards are running at the same time, they will consume too much power and >cause a problem. > >So, we want to impose a lockout time at the beginning of the software; the >lockout time should be random for each board (though they use the same >software). Only after the lockout time expires would the program start >running. Thus the boards will start at different time and won't cause a >power shortage. > >My question is: how to generate a "truly" random number on the application >of power. The number should not be determined upon the compilation of the >software, but should be upon the initial powerup of the chip. (Or, it should >be determine by each individual chip.) > >Help? > >(By the way, I write my program in C and use PICC compiler.) > >Thanks in advance. > >Tony Pan -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics