Tool/software: Code Composer Studio
Hello,
Trying to print the voltage and current reading on an LCD using spi in the concerto device. The readings are floating point values that change in real time and so i have been trying to do that by using sprintf and formatting a string, then passing the formatted string as part of the SPI data transfer. But it prints junk values instead of the string. I want to know if i am using sprintf function correctly. Below is the piece of code involving the sprintf().
char stringA[17]; float Vref1,Iref1; sprintf(stringA, "%f VDC %f A",Vref1,Iref1);
I pass stringA as an argument in the SPI transfer function. And i don't see any cogent output, just a bunch of random characters with the same length as that of the string. I just want to confirm that everything else works just fine. I am able to print regular characer strings without any issue.
Problem is only with printing strings with real time float variables in them. Been using sprintf() to accomplish this but to no avail. Am i doing this incorrectly?? or is this not possible to achieve using sprintf()?? I do have the library function assumptions set to minimal sprintf() usage.
Any suggestion is greatly appreciated, thank you for your time.
Srini