Hello,
I have the following code, it works fine, the only other thing I want it to do is display decimal point to the LCD. It simply reads some voltage on a analog pin and displays it on the screen, it work fine for single digit only as it is. Any help will be appreciated.
I have the following code, it works fine, the only other thing I want it to do is display decimal point to the LCD. It simply reads some voltage on a analog pin and displays it on the screen, it work fine for single digit only as it is. Any help will be appreciated.
Code:
void Voltage (void)
{
char line[16];
int Vref = 5000.0; //Converts reading from ADC to mV
double ADCBubbleV, BubbleV;
int bADCVal, BubbleVi;
SetChanADC(ADC_CH6);
XLCDDelay4ms ();
ConvertADC(); // Start conversion
while( BusyADC() ); // Wait for completion
XLCDDelay4ms ();
bADCVal = ReadADC(); // Read ADC
ADCBubbleV = ((bADCVal/1024.0) * Vref);
XLCDDelay4ms ();
BubbleV = ((ADCBubbleV)/(204.0));
XLCDDelay4ms ();
XLCDL2home();
XLCDPutRomString("Bubble (V): ");
BubbleVi = (int)BubbleV;
sprintf(line,"%d",BubbleVi);
XLCDPutRamString(line);
XLCDPutRomString(" ");
XLCDDelay4ms ();
}