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

Conversion of Hex data into char format

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



Joined: 10 Feb 2007
Posts: 78

View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger

Conversion of Hex data into char format
PostPosted: Thu Aug 14, 2008 10:51 am     Reply with quote

Gents,

I am trying to send a hex data from an application on my computer, to my 18F4680 based web server and displaying this data over the hyper terminal.

Now the data that is being sent, is being shown as character format. So to display the data in terms of hex, I would have to convert the existing Hex data into character format.

Does anyone know of any software which can convert hex data into char format data?

Regards
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Thu Aug 14, 2008 2:35 pm     Reply with quote

There are many ways to represent hex. data, for example:
Code:
'11 AA 22 BB 33 CC'               ASCII characters with spaces
'11AA22BB33CC'                    ASCII characters with spaces
'0x11 0xAA 0x22 0xBB 0x33 0xCC'   ASCII characters preceded by '0x'
'0x11AA22BB 0x33CC'
etc...
An example of what you want to achieve would help a lot.

Use the search function of this forum. Similar questions have been discussed dozens of times.
gribas



Joined: 21 Feb 2008
Posts: 21

View user's profile Send private message

PostPosted: Thu Aug 14, 2008 3:02 pm     Reply with quote

or if you just want to see the incoming data in hex format you could use a better terminal application, like Terminal. There you can see the character 'A' as 41.

http://braypp.googlepages.com/terminal
Foppie



Joined: 16 Sep 2005
Posts: 138
Location: The Netherlands

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

PostPosted: Fri Aug 15, 2008 3:05 am     Reply with quote

CKielstra is right, give some more information and the replie you get are more to your liking.

What I think you search for is the following:
Code:
int32 data = 23832442;

printf("DATA: %lX", data);

This sends "DATA: 16BA77A"
tranz



Joined: 10 Feb 2007
Posts: 78

View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger

PostPosted: Fri Aug 15, 2008 8:45 am     Reply with quote

Thanks for all the responses guys, the problem is solved now.

The initial problem was that I was using internet to transfer data across the network, the data that was being transferred was then displayed over on the hyper terminal. Since the data was in binary format, and not readable I had to convert it to hex to make it understandable. The problem was that each individual hex character was being converted to hex again at the PIC end. The pic that was used is 18F4680 which acts like a client.

So I wanted something which would be in character form and then when I would send the data, it would get converted to hex.

The solution was simple, I opened the .out file in notepad and loaded this .txt file on to the internet application, so when the data was received on the PIC end, it was taken in as characters and converted in hex, which was what I wanted.

Thanks again for all the suggestions

Much appreciated.

The solution was that
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