cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

Hi

   

I need to use sprintf function with float numbers. But it does not work. 

   
    

         val=1.2243;
        sprintf(text,"Value=%f",(float)val);

    

        LCD_Position(0u,0u);
        LCD_PrintString(text);

   
   

Is there a setting in this regard?

   
    

 

   
0 Likes
Reply
1 Solution
Esteemed Contributor II

To get sprintf() running you need to

   

    #include <stdio.h>
    Set "use newlib nano"
    Set "Use newlib nano float formatting" in Build Settings -> Linker
    And increase heap size to 0x0200 in system view.

   


Bob

View solution in original post

0 Likes
Reply
2 Replies
Esteemed Contributor II

To get sprintf() running you need to

   

    #include <stdio.h>
    Set "use newlib nano"
    Set "Use newlib nano float formatting" in Build Settings -> Linker
    And increase heap size to 0x0200 in system view.

   


Bob

View solution in original post

0 Likes
Reply
Anonymous
Not applicable

Thanks Bob,

   

I'm Fixed it

0 Likes
Reply