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

Sending 00 as hexadecimal

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



Joined: 25 Nov 2004
Posts: 30
Location: Germany

View user's profile Send private message

Sending 00 as hexadecimal
PostPosted: Wed Apr 13, 2005 7:30 am     Reply with quote

Hello everybody,

I use a 18F458 to write on a display. I have to send the letters and numbers in hexadecimal form by RS232. It works very well. For sending I use:

printf("/x5D/x34"); //sending 5Dh and 34h

For ending a character string, I have to send 00h. But when I connect the copmuter to the PIC by RS232, I see that it doesnot send the 00h.

If the PIC has the following command:
printf("\x1B\x5A\x4C\x00\x00\x4C\x65\x66\x74\x7C\x4F\x6B\x00");

the computer receives:
1Bh 5Ah 4Ch 65h 66h 74h 7Ch 4Fh 6Bh

The first two times 00h are the position of the text, the last 00h shows the end of the text.

Does someone know, what to do? I really need to send the 00h.

Thanks for answers, pom
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Wed Apr 13, 2005 7:49 am     Reply with quote

How about
putc(0);
_________________
The search for better is endless. Instead simply find very good and get the job done.
Mark



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

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

PostPosted: Wed Apr 13, 2005 7:59 am     Reply with quote

It sounds like your receiving program is reading the data as though it was a string in which case 0 is a NULL or string terminator. Then I suspect that you take each byte and convert it to text. That would explain your output. You will need to treat the data as binary and keep track of how many bytes you receive and then convert them to text or have the PIC convert the data to text and send the data as text.
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