Pseudo Random Number Generator in xmc4500

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi,
i am working on xmc4500, in my project i want to use Random Number Generator, from xmc4500 reference manual -> DAC , i found that "Pseudo Random Number Generator" Will Generate the Random Number, and for that i Configured as below

/* De asserted the DAC module in RCU(Reset Control Unit) */

/* Configured the mode to Noise and SIGN,SIGNEN, FREQ bits in DAC0CFG0 Register */

/* Configured the TRIGMODE to Noise and ANEN = 0, and SCALE,MULDIV,OFFS,DATMOD in DAC0CFG1 Register */

/* Cofigured the DAC0DATA Register with 0x03F value */

/* Configured the DAC01DATA Register with 0x0AFF Value */


Finally i Triggered the SWTRIG = 1 in DAC0CFG1 Register

Now my doubt is from which Register i Should Collect the Random Number ???

Thanks and Regards,
Harshan.
0 Likes
3 Replies
Not applicable
Hello,

I use randomlib.c to generate random numbers within my XMC project:

This Random Number Generator is based on the algorithm in a FORTRAN
version published by George Marsaglia and Arif Zaman, Florida State
University; ref.: see original comments below.
At the fhw (Fachhochschule Wiesbaden, W.Germany), Dept. of Computer
Science, we have written sources in further languages (C, Modula-2
Turbo-Pascal(3.0, 5.0), Basic and Ada) to get exactly the same test
results compared with the original FORTRAN version.
April 1989
Karl-L. Noell
and Helmut Weber

This random number generator originally appeared in "Toward a Universal
Random Number Generator" by George Marsaglia and Arif Zaman.
Florida State University Report: FSU-SCRI-87-50 (1987)
It was later modified by F. James and published in "A Review of Pseudo-
random Number Generators"
THIS IS THE BEST KNOWN RANDOM NUMBER GENERATOR AVAILABLE.
(However, a newly discovered technique can yield
a period of 10^600. But that is still in the development stage.)
It passes ALL of the tests for random number generators and has a period
of 2^144, is completely portable (gives bit identical results on all
machines with at least 24-bit mantissas in the floating point
representation).
The algorithm is a combination of a Fibonacci sequence (with lags of 97
and 33, and operation "subtraction plus one, modulo one") and an
"arithmetic sequence" (using subtraction).

Use IJ = 1802 & KL = 9373 to test the random number generator. The
subroutine RANMAR should be used to generate 20000 random numbers.
Then display the next six random numbers generated multiplied by 4096*4096
If the random number generator is working properly, the random numbers
should be:
6533892.0 14220222.0 7275067.0
6172232.0 8354498.0 10633180.0

The SW is easy to use and reliable.

Regards
Kurt
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi,

May I know where to download this code?
0 Likes
Not applicable
Hi Travis,

here it is. http://sourcecodebrowser.com/kanatest/0.3.6/files.html
Click Files & download from the list.

It's developed at a German University.

Regards
Kurt from Berlin/Germany
0 Likes