Home

Single precision float value to string

When doing microcontroller programming one may have come across a task of converting a float value to a string. For example when a float value is to be displayed on LCD or it is to be passed out through a UART port. The simple method is to use sprint() function. This function is exactly same as commonly used printf() function. The only difference is that sprint() pass the output to an array instead of some kind of display.

This is an extremely simple way to convert float to string. But the main disadvantages are the memory consumption and time for execution. I have developed a very short and furiously fast code for this conversion. Read the article below.

 

Full source code for this can be downloaded from here.

 


Attachments:
Download this file (float to string conversion.pdf)Float to string conversion[A fast and compact code for float to string conversion]536 Kb
Last Updated on Saturday, 30 April 2016 05:56
 
 
  • Three phase sine wave inverter
    Three phase sine wave inverter
  • Static Voltage Stabilizer
    Static Voltage Stabilizer
  • Induction Lamp Ballast
    Induction Lamp Ballast
  • 3-Phase Solar Pump
    3-Phase Solar Pump
  • 3-Phase 3-wire Voltage optimizer
    3-Phase 3-wire Voltage optimizer
  • Interleaved MPPT Charger
    Interleaved MPPT Charger
  • Sine wave inverter
    Sine wave inverter