piclist 2001\08\16\181024a >
Thread: Generating a "truly" random number on the application of power
www.piclist.com/techref/microchip/math/index.htm?key=random
flavicon
face BY : mikespam@TakeThisOuTwhitewing.co.uk



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:

{Quote hidden}

--
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


<eh3ont4bm8vr2jifa1tl6bna812fmnmin1@4ax.com> quoted-printable

In reply to: <004301c124e5$1315efc0$e9a2fea9@90yk30b>
See also: www.piclist.com/techref/microchip/math/index.htm?key=random
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Generating a "truly" random number on the application of power

month overview.

new search...