1 2 Previous Next 27 Replies Latest reply on Dec 3, 2018 4:01 PM by MoTa_728816

    Problem printing float


       I have been through the knowledgebase and applied suggestions 


      Project -> Build Options -> linker -> Command Line -> -u_printf_float


      Then tried Linker -> General -> Use newlib nano ... False


      Finally tried, asm (".global _scanf_float"); 


      None of these seemed to help. I can sprintf decimal values and strings ok but not floating point.


      I am using Psoc Creator 3.2 SP1, ARM GCC 4.8.4 compiler, debug build


      Here is my code (initially I was trying to print a float var but set an exlicit value to test)


      #include "stdlib.h"


      char tbuf[50];


      sprintf(tbuf,"%f",(float) 1.35);


      When I run this my buffer has values like


      0x00, 0x2E, 0x80, 0x00, 0x20, 0x11, 0x00 ...


      instead of  0x31, 0x2E, 0x33, 0x35


      Any help much appreciated





        1 2 Previous Next