Hi,
Do you want to know the battery voltage or do you want to know
when the battery is low,because I have the code for if you
want to know the battery voltage.
I am using a LCD.
here is the code (in pic C).
// To read analog i/p and writes battery voltage to LCD when "reset" (inputB7) is pressed
// force ADC to 8-bit in wizard ************************* NB ! ! *******
set_adc_channel(0);
delay_ms(40);
value = read_adc();
delay_ms(20);
dec();
a1 = hund;
b = tens;
c = ones;
ASCII();
ana1 = a1;
ana2 = b;
ana3 = c;
LCD_FunctionMode();
LCD_Write_4_Bit(clear_lcd);
LCD_Write_4_Bit(0xd4); // Goto line 4 positoin 1
LCD_DataMode();
LCD_Write_4_Bit('B');
LCD_Write_4_Bit('a');
LCD_Write_4_Bit('t');
LCD_Write_4_Bit('t');
LCD_Write_4_Bit('.');
LCD_Write_4_Bit('V');
// LCD_Write_4_Bit('o');
// LCD_Write_4_Bit('l');
// LCD_Write_4_Bit('t');
LCD_Write_4_Bit('=');
// LCD_Write_4_Bit(' ');
LCD_FunctionMode();
LCD_Write_4_Bit(0xdc); // Goto line 4 positoin 7
LCD_DataMode();
LCD_Write_4_Bit(ana1);
LCD_Write_4_Bit(ana2);
LCD_Write_4_Bit(',');
LCD_Write_4_Bit(ana3);