PDA

View Full Version : Please help- random data selection



geo2012
11-28-2009, 10:49 AM
I would be greatful if someone can help me figure out random data selection. I am trying to get my bs2px to randomly select the data below when a button I have interfaced is pressed.



here is an example:
lower8··· VAR··· OUTL

info······· VAR··· Byte

digit 1··· DATA· %00000001, ( 7 more bytes)
digit 2··· DATA· %00000010
digit3···· DATA· %00000100
digit4·····DATA· %00001000
digit5·····DATA· %00010000
digit6··· DATA···%00100000

main:
random
here I want it to randomly select·a digit·stored·in·data every time a button I have interfaced is pressed
I can get it to read it with
FOR info = 0 TO 7
READ (digit1 + info), lower8
but not randomly read it

Thank You

allanlane5
11-28-2009, 10:56 AM
EPROM 'DATA' is filled from location 0 up.

So, all you have to do is use the "RANDOM" statement to create a random value from 0 to 7, and then issue a READ statement with that value.