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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/16/03 08:17
Read: times


 
#43533 - RE: Keypad Interpretation - Tan
Responding to: ???'s previous message
Well to convert the number in the buffer is best done as follows:

Zero a binary number accumulator. This may be 16-bit, 24-bit, or even 32-bit depending on the size of numbers you are dealing with.

Setup an index to scan the buffer from left to right.

LOOP:
Make a loop that will run a number of iterations as equal to the number of digits in the buffer.

Take the current indexed digit and convert it to binary 0-9 value.

Add this digit to the binary number accumulator.

Check if on last digit and if so then stop loop. IE goto stop.

Multiply the binary accumulator by ten. This can often be done as follows....save a copy of the binary accumulator....then shift the binary accumulator left by two....finally add the saved copy to the binary accumulator. (This works becasue x*10 = (x*2)*2)+x).

Increment the digit access index.

Jump back to LOOP.

STOP:
All finished.


Michael Karas








List of 10 messages in thread
TopicAuthorDate
Keypad Interpretation            01/01/70 00:00      
   RE: Keypad Interpretation            01/01/70 00:00      
      RE: Keypad Interpretation            01/01/70 00:00      
         RE: Keypad Interpretation            01/01/70 00:00      
   RE: Keypad Interpretation            01/01/70 00:00      
   RE: Keypad Interpretation - Tan            01/01/70 00:00      
      RE: Keypad Interpretation - Tan            01/01/70 00:00      
      RE: Keypad Interpretation - Tan            01/01/70 00:00      
   RE: Keypad Interpretation            01/01/70 00:00      
      RE: Keypad Interpretation            01/01/70 00:00      

Back to Subject List