View previous topic :: View next topic |
Author |
Message |
guest Guest
|
regarding receiving integer using RS232 |
Posted: Sat Feb 19, 2005 3:50 pm |
|
|
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
|
|
Posted: Sun Feb 20, 2005 8:51 am |
|
|
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
|
|
Posted: Sun Feb 20, 2005 9:35 am |
|
|
Take a look at
atoi()
atol()
atoi32()
in the manual or help file. |
|
|
|