On any machine without hardware divide, the easiest and usually fastest is repeated subtraction of powers of 10. First, count how many times you can subtract 10000 before the result is negative. That's your 10000's digit. Add 10000 once to make it positive again, then do the same for 1000, 100, 10, and then what's left is your 1's digit. For signed numbers, you need to complement negative numbers (remembering the - sign for later...). > -----Original Message----- > From: anbarsystem@ZAZ.COM.BR [SMTP:anbarsystem@ZAZ.COM.BR] > Sent: Tuesday, October 19, 1999 5:16 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: CONT 16-BIT TO DECIMAL > > I need help. > In a project that I am doing with the PIC16F84, I have a binary count of > 16-bits. > Exists a way of converting an count of 16-bits in a decimal value, see > example: > Cont 16-bits has the value 1000111000 or hex 118 > I need this value in decimal = 280. > Somebody could help me. > Thanks in advance > AnBar