Display Single precision float by "snprintf" to LCD
Posted: Thu Sep 02, 2010 3:23 pm
Hello,
I want to display a 9 digit float value with 6 digit after the point displaying on LCD
I have made de next declarations FREQ = String[10] and FT = Float.
I put the "snprintf(FCV_FREQ,10,"%9,6f",FCV_FT)" into C Code ("%9,6f" = 9 digit float value with 6 digits after point, 9 digits included with point makes 10 digits so the String array lengt wil be 10 = FREQ[10])
And write the ouput result to LCD with PrintString var = FREQ
When compile it by ARM FCv4 I get the next result;
File name: K:\FlowCode projects\OlimexSAM7P256_Projects_FCv4\Flowcode1.c
Generated by: Flowcode v4.3.8.64
Date: Thursday, September 02, 2010 17:42:52
Licence: Professional
Registered to: Huib Koppers
Launching the compiler...
C:\Program Files (x86)\Matrix Multimedia\Flowcode ARM V4\Tools\MX_bats\arm7comp.bat "Flowcode1" "K:\FLOWCO~1\OLIMEX~1"
In file included from Flowcode1.c:37:
C:/PROGRA~2/MATRIX~1/FLOWCO~1/Tools/MX_bats/../Global/OSstubs.c:192: warning: 'struct tms' declared inside parameter list
C:/PROGRA~2/MATRIX~1/FLOWCO~1/Tools/MX_bats/../Global/OSstubs.c:192: warning: its scope is only this definition or declaration, which is probably not what you want
Flowcode1.c: In function 'main':
Flowcode1.c:527: warning: implicit declaration of function 'snprintf'
Flowcode1.c:527: warning: incompatible implicit declaration of built-in function 'snprintf'
Flowcode1.c:527: warning: passing argument 1 of 'snprintf' discards qualifiers from pointer target type
Flowcode1.c:532: error: syntax error before 'FCD_LCDDisplay0_Cursor'
Flowcode1.c:537: warning: passing argument 1 of 'FCD_LCDDisplay0_PrintString' discards qualifiers from pointer target type
Flowcode1.c:487: warning: return type of 'main' is not 'int'
Error returned from [arm-elf-gcc.exe]
Return code = 1
Even if I use the "sprintf" function with sprintf(FCV_FREQ,"%9,6f"FCV_FT), I get the same results.
Question: Why do I get the error "syntax error before 'FCD_LCDDisplay0_Cursor' " and what i am doing wrong ?
Regards
Huib
I want to display a 9 digit float value with 6 digit after the point displaying on LCD
I have made de next declarations FREQ = String[10] and FT = Float.
I put the "snprintf(FCV_FREQ,10,"%9,6f",FCV_FT)" into C Code ("%9,6f" = 9 digit float value with 6 digits after point, 9 digits included with point makes 10 digits so the String array lengt wil be 10 = FREQ[10])
And write the ouput result to LCD with PrintString var = FREQ
When compile it by ARM FCv4 I get the next result;
File name: K:\FlowCode projects\OlimexSAM7P256_Projects_FCv4\Flowcode1.c
Generated by: Flowcode v4.3.8.64
Date: Thursday, September 02, 2010 17:42:52
Licence: Professional
Registered to: Huib Koppers
Launching the compiler...
C:\Program Files (x86)\Matrix Multimedia\Flowcode ARM V4\Tools\MX_bats\arm7comp.bat "Flowcode1" "K:\FLOWCO~1\OLIMEX~1"
In file included from Flowcode1.c:37:
C:/PROGRA~2/MATRIX~1/FLOWCO~1/Tools/MX_bats/../Global/OSstubs.c:192: warning: 'struct tms' declared inside parameter list
C:/PROGRA~2/MATRIX~1/FLOWCO~1/Tools/MX_bats/../Global/OSstubs.c:192: warning: its scope is only this definition or declaration, which is probably not what you want
Flowcode1.c: In function 'main':
Flowcode1.c:527: warning: implicit declaration of function 'snprintf'
Flowcode1.c:527: warning: incompatible implicit declaration of built-in function 'snprintf'
Flowcode1.c:527: warning: passing argument 1 of 'snprintf' discards qualifiers from pointer target type
Flowcode1.c:532: error: syntax error before 'FCD_LCDDisplay0_Cursor'
Flowcode1.c:537: warning: passing argument 1 of 'FCD_LCDDisplay0_PrintString' discards qualifiers from pointer target type
Flowcode1.c:487: warning: return type of 'main' is not 'int'
Error returned from [arm-elf-gcc.exe]
Return code = 1
Even if I use the "sprintf" function with sprintf(FCV_FREQ,"%9,6f"FCV_FT), I get the same results.
Question: Why do I get the error "syntax error before 'FCD_LCDDisplay0_Cursor' " and what i am doing wrong ?
Regards
Huib