![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| dear all, anyone knows how to "continuosly " generating a series of random number in 16f628, prefereble in using pic basic. I try using random command but it does not generate the random number. thanks! cheers, | |
| |
| | (permalink) |
| I don't know how to write basic for pic, but i remembered that there is a algorithm to build random function as I studied on programming in high school. The fact that random is not relly random, but it's made from an algorithm that choose one of upto 10^12 matrix elements in Pascal. And if you want, you can make it. Perhaps you have to review how to generate random function in high level languages, and then do it in PICs. I'm in doubt that high level language for PIC can give random function. If you find out the ans, pls tell meeh. I also care bout it.
__________________ Falleaf mail@falleaf.net English forums at PIC Vietnam - Vietnamese Electronics forums R&P Trading and Forwarding Co. Ltd. Distributor of Microchip in Vietnam | |
| |
| | (permalink) |
| might be of interest http://www.phanderson.com/PIC/16C84/random.html Just google it... comes up with lots of hits | |
| |
| | (permalink) |
| Try this, gets numbers from 1 to 255 Code: FOR R = 0 TO 10 X= RANDOM+X NEXT R RND=X/250 RND is BYTE long I hope ist help. Why is the random command not generating you random numbers ? It is 16 bit long 1 - 65535, there is 65535 combination, I just tried, for 5 min I have never got the same number !? [1sec/num] STEVE | |
| |