Society of Robots - Robot Forum

Software => Software => Topic started by: Rebelgium on September 13, 2008, 09:23:58 AM

Title: PIC18 DEC to HEX conversion in C
Post by: Rebelgium on September 13, 2008, 09:23:58 AM
Hi everyone,
Is it possible to do a DEC to HEX conversion in C language?
(Or ASM if it's not possible in C)

I googled it, but didn't get satisfying results... :/

I have a variable called "ServoPos", and after a dec to hex conversion I need to fill this value into a CCP register. (could I use a BIN value for this to? if so, a DEC to BIN conversion is also ok)
Title: Re: PIC18 DEC to HEX conversion in C
Post by: MadMax on September 13, 2008, 05:16:21 PM
You know that every variable is stored in HEX in memory right... So, when you have (for example) TRISD, and you would assign the value 3 to it. You would be assigning the HEX value 0x03.
I came up with this link, if the above is not what you're looking for:
http://mathforum.org/library/drmath/view/54347.html