#include "C:\RS\projekty\4lcdmob\main.h"

#define LCD_RS          PIN_B1      // rizeni registru LCD displeje
#define LCD_E           PIN_B0      // enable LCD displeje
#define LCD_DATA_LSB    PIN_C0     // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)

#include "mylcd.c"

int sig[20];

void main()
{

   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);

lcd_init();
delay_ms(150);

printf(lcd_putc,"Baterie je nabita na");
lcd_gotoxy(1,3);
printf(lcd_putc,"a napajeni zajistuje");
while(TRUE)
{  
   printf("AT+CBC\r");
   gets(sig);
   getc();
   gets(sig);
   
   lcd_gotoxy(6,2);
   printf(lcd_putc,"%c%c procent",sig[9],sig[10]);
   
   if(sig[7]==38)
   {
      lcd_gotoxy(7,4);
      printf(lcd_putc,"baterie");
   }
   else
   {
      lcd_gotoxy(9,4);
      printf(lcd_putc,"sit");
   }
   
   delay_ms(2500);
  
}
}