Convert a word variable to decimal
Hi,
I searched the forums and haven't found the answer. I came across a nice thread where Melanie explains how to preset a value to the EEPROM and later read it back. I need something slightly different:
1. ask user for a 4-digit decimal number (WORD variable)
2. store it to EEPROM using WRITE
3. on next power up READ the number into a WORD variable as a decimal number
I can do number 1 & 2.
But when it comes to READing the stored password I don't know how to convert it from the 2 hex bytes back to a 4-digit decimal number (stored in a WORD)
Code:
myVar VAR WORD
READ 0, myVar.BYTE0
READ 1, myVar.BYTE1
But how do I get a decimal number from that is beyond me.
Thanks,
Tom