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.

Problem to compile sprintf with MSp430g2553 and CCS v6

Hi,
yesterday I've upgraded my version of CCs to version 6. I loaded my old programs compiled with version 4, but I have some problems with function sprintf.

Basically I have to send out to an external lcd display a string which contains a float value. I defined

float MY_VALUE //float value to be sent

unsigned char MY_STRING[30] // string to be filled with float value.

This 2 variables are contained in only one struct definition with other parameters not so important for this purpose.

Then I wrote sprintf

sprintf(MY_STRING, "%5.1f", MY_VALUE);

I imagine that MY_STRING content should be the exact trascription number by number of float value (right?), but that's the point! I don't find this... In debug mode I find that MY_STRING contains at second position the value "f" followed by (maybe) other unpredictible or non sense values from conversion.

I read a previous post in which TIer have suggested to install a previous version of Compiler. Is this the solution also for my case?

Thanks in advance...

Marco

  • Check your setting for the compiler option --printf_support.  If it says --printf_support=minimal, then that's the problem.  Change it to --printf_support=full.  That change, however, may cause your code size to grow bigger than the memory you have available.  Read more about it in the MSP430 compiler manual.

    Thanks and regards,

    -George