0

Hi,

I’m having an issue formatting strings to be output via the serial port R_UART0_Send() function…

Constant strings don’t seem to have an issue, but if I try to insert data using a format specifier, the resulting string is corrupted and doesn’t print properly.

 

e.g.

strMsg = sprintf(“Test string….\r\n”);

R_UART0_Send( strMsg, strlen(strMsg) ); This works…

//—————————————————————//

strMsg = sprintf(“Test string….0x%02X\r\n”, hexVal);

R_UART0_Send( strMsg, strlen(strMsg) ); This doesn’t work…

//—————————————————————//

It doesn’t seem to matter whether the variable strMsg is defined as a uint8_t * or as a char *.

The thing is, it worked initially (As I’ve built up the code it seems to have gotten worse)…

 

Any hints or suggestions would be appreciated…

 

Steve

narashiman 回答済