This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

printf() problem

Hello,

I'm using Keil to write data over the serial port.

ubyte b=0x0A;
printf("%c",b);


with this code I reveive two bytes: “0x0D” and “0x0A” in PC instead of “0x0A”. This happens only with “0x0A”. What's wrong with it?

Thanks
Senmeis

Parents
  • As far as I remember, the default implementation of putchar() in C166 expands '\n' into '\r\n'. Besides, the implementation is blocking. You should implement your own putchar(). You can take the default implementation and remove the '\n' expansion. If you need interrupt-driven serial I/O, have a look at the traffic example program.

Reply
  • As far as I remember, the default implementation of putchar() in C166 expands '\n' into '\r\n'. Besides, the implementation is blocking. You should implement your own putchar(). You can take the default implementation and remove the '\n' expansion. If you need interrupt-driven serial I/O, have a look at the traffic example program.

Children
No data