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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/21/99 10:00
Read: times


 
#991 - RE: Convert 16bit counter to decimal/ascii
Hi Rich,

In 16-bit counter you may put max 65535. Therefore your decimal number will take max 5 positions.

To get first position (ones) you have to divide binary number by 10. The remainder gives you the ones (5). For example, 65535:10 = 6553 as quotient and 5 as remainder.

To get second position (tens) you have to divide quotient by 10. The new remainder gives you the tens (3). For example, 6553:10 = 655 as a new quotient and 3 as a new remainder.

And so on for next positions.

To convert ones, tens,... into ASCII character you have to add 030H to ones, tens etc.

I hope this helps you.

Bye,

Igor


List of 2 messages in thread
TopicAuthorDate
Convert 16bit counter to decimal/ascii            01/01/70 00:00      
RE: Convert 16bit counter to decimal/ascii            01/01/70 00:00      

Back to Subject List