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

regarding receiving integer using RS232

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







regarding receiving integer using RS232
PostPosted: Sat Feb 19, 2005 3:50 pm     Reply with quote

Hi everyone,
I am sending an integer as a hex to kit, through RS232. When I try to receive it using getc(), and store its value in an integer, and try to print it out back on the hyperterminal, it shows the ASCII value of the integer, that I typed,instead of the exact integer value in hexadecimal. I would like to know, can we use getc to receive integer and store it in an integer. Is there anyway to convert a string into an integer.
Thanks for any help
sk
Sherpa Doug
Guest







PostPosted: Sun Feb 20, 2005 8:51 am     Reply with quote

RS232 send bytes. A byte is a byte is a byte. I suspect your problem is that Hyperterminal is translating the received byte to an ASCII character. One solution is to have the PIC convert from int to ASCII and then send the ASCII characters to Hyperterminal. My solution would be to scrap Hyperterminal. It is a lousy terminal program. For work with PIC the SIOW program that comes free from CCS is much better. Better still is Terminal.exe from http://bray.velenje.cx/avr/terminal

Sherpa Doug
Mark



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

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

PostPosted: Sun Feb 20, 2005 9:35 am     Reply with quote

Take a look at

atoi()
atol()
atoi32()

in the manual or help file.
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