Author Topic: PIC18 DEC to HEX conversion in C  (Read 4339 times)

0 Members and 1 Guest are viewing this topic.

Offline RebelgiumTopic starter

  • Supreme Robot
  • *****
  • Posts: 638
  • Helpful? 0
  • It's called the future ... We like it here
PIC18 DEC to HEX conversion in C
« 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)
« Last Edit: September 13, 2008, 10:04:36 AM by Rebelgium »
To relax after some hard work on robotics: A very fun free online text based MMORPG
orgcrime.net

Offline MadMax

  • Full Member
  • ***
  • Posts: 58
  • Helpful? 0
Re: PIC18 DEC to HEX conversion in C
« Reply #1 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

 

Related Topics

  Subject / Started by Replies Last post
18 Replies
5913 Views
Last post September 27, 2006, 02:00:49 PM
by seal killer
0 Replies
1629 Views
Last post May 08, 2007, 06:46:59 PM
by PrinceOfFlame
12 Replies
2854 Views
Last post July 27, 2008, 07:34:47 AM
by Admin
2 Replies
984 Views
Last post January 03, 2009, 11:19:50 PM
by TrickyNekro


Get Your Ad Here