10 Replies Latest reply on Jul 14, 2015 7:47 AM by JoMe_264151

    Convert float number to ASCII to transfer data via UART to other microcontroller

       Hi there,


      I would like to convert float number into ASCII or character or string in oder to send over UART. 


      I tried sprintf and all other function available, but it doesn't work, when I check in teraterm or realterm software. 


      So, I am looking for actual method that can convert float to ascii same as itoa. I got itoa method as below, which works fine


      char* itoa(int val, int base){




      static char buf[32] = {0};




      int i = 30;




      for(; val && i ; --i, val /= base)




      buf[i] = "0123456789abcdef"[val % base];




      return &buf[i+1];







      but, would like to make ftoa. In above method modulo of floating point doesn't work. So looking for some other method.


      Any help would be great !!