Display Float on LCD – MPLAB XC8 – electroSome https://electrosome.com/topic/display-float-lcd-mplab-xc8/feed/ Sat, 18 Mar 2023 04:34:59 +0000 https://bbpress.org/?v=2.6.9 en-US https://electrosome.com/topic/display-float-lcd-mplab-xc8/#post-10277 <![CDATA[Display Float on LCD – MPLAB XC8]]> https://electrosome.com/topic/display-float-lcd-mplab-xc8/#post-10277 Mon, 22 Dec 2014 13:34:56 +0000 sahu How to display floating point values on LCD ? I am using MPLAB XC8 LCD Library.

]]>
https://electrosome.com/topic/display-float-lcd-mplab-xc8/#post-10280 <![CDATA[Reply To: Display Float on LCD – MPLAB XC8]]> https://electrosome.com/topic/display-float-lcd-mplab-xc8/#post-10280 Mon, 22 Dec 2014 16:49:50 +0000 Ligo George You can display floating point values on LCD in following two methods.

  1. By converting floating point value to string and display that sting using Lcd_Write_String()
  2. By separating each digits and display that digit using Lcd_Write_Char() after converting it to character

The second method is the best method but it will vary depending upon the length of values that to be displayed.

]]>
https://electrosome.com/topic/display-float-lcd-mplab-xc8/#post-10281 <![CDATA[Reply To: Display Float on LCD – MPLAB XC8]]> https://electrosome.com/topic/display-float-lcd-mplab-xc8/#post-10281 Mon, 22 Dec 2014 18:19:21 +0000 sahu Please give me a example of first method.

 

]]>
https://electrosome.com/topic/display-float-lcd-mplab-xc8/#post-10289 <![CDATA[Reply To: Display Float on LCD – MPLAB XC8]]> https://electrosome.com/topic/display-float-lcd-mplab-xc8/#post-10289 Tue, 23 Dec 2014 01:48:16 +0000 Ligo George 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);
    ...........
    .....
  }
}
]]>
https://electrosome.com/topic/display-float-lcd-mplab-xc8/#post-10321 <![CDATA[Reply To: Display Float on LCD – MPLAB XC8]]> https://electrosome.com/topic/display-float-lcd-mplab-xc8/#post-10321 Tue, 23 Dec 2014 10:35:53 +0000 sahu Thank you Sir

]]>
https://electrosome.com/topic/display-float-lcd-mplab-xc8/#post-10424 <![CDATA[Reply To: Display Float on LCD – MPLAB XC8]]> https://electrosome.com/topic/display-float-lcd-mplab-xc8/#post-10424 Tue, 06 Jan 2015 10:35:04 +0000 sahu what wrong with me `

a = ADC_Read(0);
involts =a*5000/255;
delayMs(10);
{
  Lcd_Clear();
  Lcd_Set_Cursor(1,1);
  Lcd_Write_String("Mains");
  /*
    Lcd_Set_Cursor(1,10);
    Lcd_Write_Char(involts%10 + 48);
    involts = involts/10;
    Lcd_Set_Cursor(1,9);
    Lcd_Write_Char(involts%10 + 48);
    involts = involts/10;
    Lcd_Set_Cursor(1,8);
    Lcd_Write_Char(involts%10 + 48);
  */
  sprintf(s, "Float = %f", involts);
  Lcd_Set_Cursor(1, 10);
  Lcd_Write_String(s);
  Lcd_Set_Cursor(1,13);
  Lcd_Write_String("VOLT");

found error as

lib\doprnt.c; 837. bad call to typeSub()
`

]]>
https://electrosome.com/topic/display-float-lcd-mplab-xc8/#post-10433 <![CDATA[Reply To: Display Float on LCD – MPLAB XC8]]> https://electrosome.com/topic/display-float-lcd-mplab-xc8/#post-10433 Wed, 07 Jan 2015 15:25:12 +0000 Ligo George
  • Try using the latest compiler
  • Make sure that you properly set the pic type in configuration
  • Try recreating the project after deleting all files
  • ]]>