View previous topic :: View next topic |
Author |
Message |
tranz
Joined: 10 Feb 2007 Posts: 78
|
Conversion of Hex data into char format |
Posted: Thu Aug 14, 2008 10:51 am |
|
|
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
|
|
Posted: Thu Aug 14, 2008 2:35 pm |
|
|
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
|
|
Posted: Thu Aug 14, 2008 3:02 pm |
|
|
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
|
|
Posted: Fri Aug 15, 2008 3:05 am |
|
|
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
|
|
Posted: Fri Aug 15, 2008 8:45 am |
|
|
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 |
|
|
|