Pic16f877a lcd problem

Thread Starter

miloboy

Joined Jun 1, 2010
19
i use ccs compiler , on the driver i saw LCD.c but i failed to use to display a float data or int data from my code .. anyone can help ?

Rich (BB code):
#include <16F877.h>
#device ADC=12
#fuses  HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
  
 #include <LCD.c>
  
 void main()
{
     int  chan ;
    float    analin[8], disvolts[8], current;
  
  setup_adc(ADC_CLOCK_INTERNAL);
 setup_adc_ports(ALL_ANALOG);
  
     while(1)
    {
     for(chan=0;chan<8;chan++)
     { delay_ms(50);
             set_adc_channel(chan);
              analin[chan] =  read_adc();
            disvolts[chan] =  (analin[chan])/204.6;
           current = (disvolts[chan]*240);
 
   lcd_init();
  
    lcd_putc("\f  hello");
   lcd_putc(current);
  
  
  
 
     }
    }
}




what shud I do if I need to display a float or int ? please help

 
Last edited by a moderator:

spinnaker

Joined Oct 29, 2009
7,830
Something like this:

Rich (BB code):
char string[20];

sprintf(string,(const far rom char*)"Panel    %2d.%02dV                ",(int)fPanelVolts ,(int)((fPanelVolts - (int)fPanelVolts) *100));
 
Top