If you want your boards to have a random dispersion due to component variation, 20% resistors might not be the best choice. Resistors are often offered in different precision grades, which is achieved by selecting the closest-tolerance parts from a production run. The ones that make 1% or 5% go into the higher-priced bin, and the rest go into the cheap bin. The bunch in the cheap bin are unlikely to have a normal distribution about the center value. If the process is well-tuned and the ones coming off the line have a nice distribution about the target value, then the cheapie parts will have a hole in the distribution where the good ones were taken out. They may all be within 20%, but NONE will be within 5%! Getting your random variation from a part like a cap that isn't sold in varying precision grades might give a more dependably random distribution of times. Maybe you could buy good resistors of varying values and mix your own random selection by dumping them in a barrel and shaking them up. > -----Original Message----- > From: Wollenberg, Frank [mailto:F.Wollenberg@GSP-BERLIN.DE] > Sent: Tuesday, August 21, 2001 9:21 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC]: Generating a "truly" random number on the > application of power > > > Tony Pan wrote: > > > Our products are used in motel environments to control ACs. > > The reason we > > need to stagger the startup is that if we don't, in case of > > power loss and > > resume, all the AC will start at the same time and that will cause a > > problem. As you know each board is situated in its room and working > > independently so there is no way one board knows what the > > other's doing. > > AC will start on power-resume AND power-on.. > > > In my hardware we use RC oscillator. Now I use the initial > > TMR0 value upon > > powerup to get a random number. I also add the initial values > > of FSR, ADRES, > > PORTB and some ADC reads of the board into the number. I > > guess that would > > give me nearly "unique" number for each board. I then use the > > last few bits > > of this number to determine the startup time. > > Using TMR0 is ok when using RC oscillator. Don't use TMR0 in crystal > operation. > FSR and ADRES are uninit on powerup, but i think they won't differ, > especially if the PIC's are from the same silizium. > PORTB must be input, but because of the identical hardware, the values > should be identical. > Reading a voltage divider with ADC is OK. Use carbon > resistors (20%). Try to > not meet the acquisition time, the Chold is varying from chip > to chip. Also > you can use an external reference voltage from a voltage > divider (carbon!). > > Compute this value ONLY on first powerup and use it as a > initial seed value > of a random generator (hint: in C: persistent). Compute a > random number as a > delay time after power becomes OK. > > > I haven't got the chance to test it yet. For we have other > features to > > implement at the moment. If you see any potential problems with this > > approach, please let me know. > > It is possible to compute identical delay times, but the > possibility is very > small. > Another approach is to use a "digital ID chip" from DALLAS > (DS2401 i think). > This number IS unique !!! > > Frank > -------------------------------------- > GSP Sprachtechnologie GmbH > Frank Wollenberg > HW-Entwicklung > Tel.: +49 (0)30 769929-78 > Fax: +49 (0)30 769929-12 > eMail: f.wollenberg@gsp-berlin.de > > > -- > GSP Sprachtechnologie GmbH > Teltowkanalstr.1, D-12247 Berlin > Tel.: +49 (0)30 769929-0 > Fax: +49 (0)30 769929-12 > eMail: Info@gsp-berlin.de > Web: http://www.gsp-berlin.de > > -- > 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