Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/24/08 10:48
Read: times


 
#157700 - does this solution make sense
Responding to: ???'s previous message
The random routine is called between waits for a button press
where the number generated is needed for display.

A register (33H) is set with a value of #1 upon initial power up.

When the random routine is called the value in register 33H is loaded into the Acc and rotated left, tested for over flow, if none return, if so reset to #1 and return.

The TIME (not the amount of times) that the register value is a 1 is less than the time it is any other value. Leaving a narrower window for a button press to capture it.

So looking at my modified code below (smaller case is the new change) do you think I am closer to a final solution?

8 machine cycles if it is a 1 and 7 cycles if it is 2 thru 6?

START:MOV A,33H ;1 MACHINE CYCLE(S)
RL A ;1
JB ACC.6,LEAP ;2
MOV 33H,A ;1
RET ;2
;
LEAP: MOV 33H,#1 ;1
nop ;1
RET ;2

Probably the same thing you have already detailed but I have to 'splain this change at a big meeting on Tuesday.

List of 28 messages in thread
TopicAuthorDate
8051 random numbers revisted - tested            01/01/70 00:00      
   Just Out Of Curiosity            01/01/70 00:00      
      yes casino            01/01/70 00:00      
   No fancy simulator required            01/01/70 00:00      
      Russ, great info here is MY code            01/01/70 00:00      
         Language-independent method            01/01/70 00:00      
            Oops            01/01/70 00:00      
               Head under arm            01/01/70 00:00      
                  HLL not an option            01/01/70 00:00      
                     HLL was just for example - easy to read            01/01/70 00:00      
         As always: The generation of random numbers ...            01/01/70 00:00      
          what is the need to CLR C            01/01/70 00:00      
            no need            01/01/70 00:00      
      does this solution make sense            01/01/70 00:00      
         Per's idea makes more sense            01/01/70 00:00      
         Don\'t use conditional jumps            01/01/70 00:00      
            Clever!            01/01/70 00:00      
      Converting Assembly to C            01/01/70 00:00      
   what about using the timer?            01/01/70 00:00      
      256 / 6 is a failure            01/01/70 00:00      
   One Suggestion for generating 1 to 6            01/01/70 00:00      
   try to use timer            01/01/70 00:00      
      yes a nice solution            01/01/70 00:00      
         How secure does this have to be ?            01/01/70 00:00      
            not much            01/01/70 00:00      
               Not "how safe?", but "how secure?".            01/01/70 00:00      
                  it passed!            01/01/70 00:00      
                     ALL THE BEST!!!            01/01/70 00:00      

Back to Subject List