Re: [bascom] Randomnumber
Hi Eric,
I think the problem with using a timer is, if the program cycles at a
constant rate, the timer values will tend to repeat themselves. The values
from the timer would be cyclic.
Could you not use a variable and a constant. You would increment the variable,
throughout the program, and when you needed a random number you could perform
some type of logic (XOR) on the two numbers to get a value , you then would
store the new value in the constant... I have never tried this -- I sure
there is a much better and more efficient way.
Regards,
Brent Nelson
Eric Le Baron wrote:
> Michael,
>
> You could have a timer running and capture its value with "var = COUNTERX"
> when the number is needed.
> If the number is a byte then Timer 0 & 1 can be used in 8-bit auto reload
> mode.
>
> Regards,
>
> Eric Le Baron
> Wageningen
> The Netherlands