Display Single precision float by "snprintf" to LCD

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Huib Koppers
Posts: 63
Joined: Fri Oct 12, 2007 5:13 pm
Location: Netherlands
Been thanked: 1 time
Contact:

Display Single precision float by "snprintf" to LCD

Post by Huib Koppers »

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
Attachments
Flowcode1.fcf_arm
snprintf test program
(5.5 KiB) Downloaded 243 times
Last edited by Huib Koppers on Fri Sep 03, 2010 8:19 am, edited 2 times in total.

Huib Koppers
Posts: 63
Joined: Fri Oct 12, 2007 5:13 pm
Location: Netherlands
Been thanked: 1 time
Contact:

Re: Display Single precision float by "snprintf" to LCD

Post by Huib Koppers »

Hello,

Please can anyone answere my question why i get this syntax error " syntax error before 'FCD_LCDDisplay0_Cursor' " after compiling and what i'm doing wrong ?

Regards

Huib
Attachments
snprintf.pdf
explanation snprintf
(46.98 KiB) Downloaded 251 times

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: Display Single precision float by "snprintf" to LCD

Post by Sean »

Hello,

The sprintf() function is not a supported part of the Flowcode distribution. The alternative gcvt() function is available and is demonstrated here:

http://www.matrixmultimedia.com/mmforum ... =26&t=6168

Note: The example program was written for Flowcode V3 and includes supplementary code that is not required by V4. If you are using V4 this supplementary code should be removed.

Huib Koppers
Posts: 63
Joined: Fri Oct 12, 2007 5:13 pm
Location: Netherlands
Been thanked: 1 time
Contact:

Re: Display Single precision float by "snprintf" to LCD

Post by Huib Koppers »

Sean,

Thanks for comment and help

Regards

Huib

Post Reply