This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5526 SPRINTF not working properly CCS5

Hi

I want to use SPRINTF to build a string that is sent by USB(CDC) to the PC.

I configured CCS mith full printf-support for debug and release.

This is what I wrote:

sprintf (outString,"Temperature: %#X bla %d \r\n",15, (signed int)15);

And this is what i expected:

"Temperatur: 0XF bla 15"

Unfortunately i get this:

"Temperatur: 0XF bla 1f"

I cant figuere out why SPRINTF behaves like this and I tried nerly everything to solve this problem.

This is what i tried so far:

- write values into local variables.

- typecasting

- different formates

For me it lookes like there is a problem with an Offset within the SPRINTF function because 1 is ASCII 31 and 5 is 35. If i add these two i get 66 what is a ascii f which fits the result i get.

Is there a way finding out what is going wrong ?

**Attention** This is a public forum