Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 21st May 2004, 04:29 PM   #1
Default Random numbers in assembly

Hi:

Does anyone know how to generate random numbers using assembly code?
I know how to do it in Basic and C, and want to know how to do it in assembly.

Thanks.
joe_1 is offline  
Old 21st May 2004, 04:51 PM   #2
Default

What do you need it for ?

if the project is driven by an external event (such as someone needs to push a button b4 something happens) then you can use that event to create a random number...
Set up a timer at the start of your program (W/O prescaling) and leave it running, and capture the timer value when someone presses the button, should be pretty random...

if it has to generate random numbers all by itself then i don't really have a clue ops: ... perhaps you should hack some of the code generated by the basic compiler to see how it works
Exo is offline  
Old 21st May 2004, 05:07 PM   #3
Default Re: Random numbers in assembly

Quote:
Originally Posted by joe_1
Hi:

Does anyone know how to generate random numbers using assembly code?
I know how to do it in Basic and C, and want to know how to do it in assembly.

Thanks.
Try here, it works fine http://www.dontronics.com/psbpix/random.html 8)
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 23rd May 2004, 05:30 PM   #4
Default

Thankx folks.
joe_1 is offline  
Old 24th May 2004, 03:09 AM   #5
Default

There are various random number algorithms such as the monte-carlo, etc. You can also capture circuit noise and have it trigger something in your software to generate random numbers. Easier said than done, but it does work.
crust is offline  
Reply

Thread Tools
Display Modes




All times are GMT. The time now is 05:39 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker