Is there a way to send int value via rs232 using usart. I want to debug my program using hyperterminal so it would be nice to see numeric values. Since putc only sends as character, is there any trick to send the numeric value.
Thanks in advance.
RossJ
Joined: 25 Aug 2004 Posts: 66
Posted: Wed Dec 08, 2004 1:35 am
You should probably use printf(). For example...
Code:
int8 x;
printf("%U", x);
will send the value of x (as an unsigned int) in ascii suitable for viewing in a terminal program.
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
Step #1: Replace Hyperterminal
Posted: Wed Dec 08, 2004 8:12 am
Printf is the easy way, as it turns the int into an ASCII string for display on an ASCII terminal. But printf has significant overhead. There is a little less overhead if you have printf produce hex instead of decimal:
Code:
int8 x;
printf("%X",x);
But your real problem is Hyperterminal. Hyperterminal is really pathetic for programming use. It has bugs and lots of wierd behavior even with the limited things it does. Hyperterminal for OS/2 was good but it fell apart when it was ported to Windows. There are lots of better programs such as the siow.exe program than comes with CCS products. My favorite is terminal.exe by Br@y++ http://bray.velenje.cx/avr/terminal/ . Terminal displays not just the ASCII but also the binary, decimal, and hex of the incomming characters. With this you can just putc(x); and read the value off your PC screen with minimal overhead for the PIC. _________________ The search for better is endless. Instead simply find very good and get the job done.
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