Please help- random data selection
geo2012
Posts: 3
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
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
Comments
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.