I am new on PIC16F877 with MikroC i used to programming in IAR of Texas Instruments well the problem is with a float number i made a simulate with PROTEUS and i have all the digits on LCD of my variable, i only need 1 digit after decimal point
do u have any solution?
thanks
Code: Select all
// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections
unsigned long valorin, valorex;
unsigned char ui,ue,di,de;
void main()
{
float valore;
float ina=0, exa;
char *txt=" ";
char *txtina="";
TRISD.F0 = 0;
TRISD.F1 = 1;
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
while(1)
{
if(PORTD.F1 == 0)
{
ina = ina + 0.10000;
Delay_ms(50);
}
lcd_out(3,18,"FR");
lcd_out(3,1,"TI");
valore = 60/1.5;
FloatToStr(valore,txt);
lcd_out(4,17,txt);
FloatToStr(ina,txtina);
lcd_out(4,1,txtina);
}
}