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.
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 ?
There is an error in MSP430 compiler version 4.0.0 with sprintf where only a single character is printed. See Only single character parameters working in printf/sprintf
This is fixed in MSP430 compiler version 4.0.1
While compiler version are you using?
(CCS 5.1 installs MSP430 compiler version 4.0.0)
Hi
Thats right, I use version 4.0.0.
I havent heard about this BUG so far and glad that it wasn't my fault ^^
Does CCS 5.2.0.Beta contain version 4.0.1 ?
Thanks for your help.
Quintin Becker said:Does CCS 5.2.0.Beta contain version 4.0.1 ?
I can't see any CCS 5.2.0.Beta release notes on Code Composer Studio Version 5 Downloads so am not sure.
You will probably get a quicker answer by posting the question in the Code Composer Studio forum.
#include <msp430.h>
#include <stdio.h> //////////////!!!!!!!!!!!!!!!
char value[20];
unsigned char x;
sprintf(value,"%d ", x);
glcd_text57(10, 30, value ,1,1);
enjoy....
**Attention** This is a public forum