CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

How to convert DD number to 0xDD?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
40inD
Guest







How to convert DD number to 0xDD?
PostPosted: Sat Sep 09, 2006 8:20 am     Reply with quote

How to convert DD number to 0xDD?
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Sun Sep 10, 2006 5:16 am     Reply with quote

If you mean convert from a decimal base10 number to a base 16 number
then a search of this board or the web should get you an answer.
If it is an output issue take a look at the printf format options.
Inside the PIC numbers are in binary base 2 representation.
To try it yourself
Take the most significant nibble (4 bits) and convert it to an 8 bit binary representation of the character you want to see ( "1"..."9","A".."F". then the least significant nibble and convert it likewise.
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

Re: How to convert DD number to 0xDD?
PostPosted: Sun Sep 10, 2006 5:35 pm     Reply with quote

40inD wrote:
How to convert DD number to 0xDD?

If you want to convert a number DD to a string "0xDD", you can use sprintf(). Please treat the following code with some sarcasm, as I'm writing without the compiler or manual at hand; this is just to give you an idea:
Code:

int8 iNumber;
iNumber = 0xDD;
printf("0x%2X", iNumber);
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group