how can I display a 64 bit number (2 longs) as decimal
phishguy
Posts: 36
I am working on software to decode a RFID chip that has a 64 bit ID. I know that it will be easy to display the hexadecimal value. However, I need to be able to display it as decimal. I actually only need the least significant 37 bits. How would I go about doing this?
·
·
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
I ran your program using tv_text instead of vga_text and didn't see any leading spaces. I also eliminated your extra byte[noparse][[/noparse]--result] := divBy10 + "0", since it was giving me a leading zero.
-Phil
text.str(string("12345678901234567890",13))
Thanks! All is well now.
n = binary number to convert to decimal string
dec2add:="1",0 'NOT VALID SPIN set one decimal string to 1
str:="0",0 'NOT VALID SPIN set output decimal string to 0
repeat until n==0
if n&1 = 1
_adddec (str, dec2add) 'NOT VALID SPIN str := str+dec2add
n=n/2 'divide by 2
adddec (dec2add,dec2add) 'NOT VALID SPIN dec2add := dec2add x 2
Adddec would be a simple chalkboard addition of the second string to the first.
I tried to describe it more but I made it sound too complicated.