Reply To: Display Float on LCD – MPLAB XC8

Home Forums Microcontrollers PIC Microcontroller Display Float on LCD – MPLAB XC8 Reply To: Display Float on LCD – MPLAB XC8

#10289

Ligo George
Keymaster

Use sprintf() to convert floating point number to string :

........
#include<stdio.h> 
......
...
...
void main()
{
  char s[16];
  float f;
  ........
  ....
  while(1)
  {
    ....
    ...
    ...
    sprintf(s, "Float = %f", f);
    Lcd_Set_Cursor(1, 1);
    Lcd_Write_String(s);
    ...........
    .....
  }
}
string(7) "9898001"