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 CCS Technical Support

hex to text

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



Joined: 14 Jan 2005
Posts: 28

View user's profile Send private message

hex to text
PostPosted: Tue May 23, 2006 3:01 am     Reply with quote

hi all
i need to convert 16bit int to ascii text so that it can be written to an sd card fat16 system file.

can you suggest an easy way to do this

thanks
Christophe



Joined: 10 May 2005
Posts: 323
Location: Belgium

View user's profile Send private message

PostPosted: Tue May 23, 2006 3:22 am     Reply with quote

perhaps:

Code:
int iValue;
char byte1;
char byte2;

byte1 =  make8(iValue,0);
byte2 = make8(iValue,1);


the way you see the byte on the PC, depends on your setting.
decimal = hex = ascii.
teekaytk



Joined: 14 Jan 2005
Posts: 28

View user's profile Send private message

PostPosted: Tue May 23, 2006 3:29 am     Reply with quote

sorry, i think i put the question in the wrong way

for example i have hex 0xFFFF
i want to write 65535 in a file for this where each letter is in ascii
so 6 is ascii 6 and 5 is ascii 5 and 3 is ascii 3.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Tue May 23, 2006 6:22 am     Reply with quote

ITOA or sprintf. This question was just asked no more than a week ago.
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