Rev Author Line No. Line
152 kapl 1 #include "C:\RS\projekty\4lcdmob\main.h"
2  
3 #define LCD_RS PIN_B1 // rizeni registru LCD displeje
4 #define LCD_E PIN_B0 // enable LCD displeje
5 #define LCD_DATA_LSB PIN_C0 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
6  
7 #include "mylcd.c"
8  
9 int sig[20];
10  
11 void main()
12 {
13  
14 setup_adc_ports(NO_ANALOGS);
15 setup_adc(ADC_OFF);
16 setup_psp(PSP_DISABLED);
17 setup_spi(SPI_SS_DISABLED);
18 setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
19 setup_timer_1(T1_DISABLED);
20 setup_timer_2(T2_DISABLED,0,1);
21 setup_comparator(NC_NC_NC_NC);
22 setup_vref(FALSE);
23  
24 lcd_init();
25 delay_ms(150);
26  
27 printf(lcd_putc,"Baterie je nabita na");
28 lcd_gotoxy(1,3);
29 printf(lcd_putc,"a napajeni zajistuje");
30 while(TRUE)
31 {
32 printf("AT+CBC\r");
33 gets(sig);
34 getc();
35 gets(sig);
36  
37 lcd_gotoxy(6,2);
38 printf(lcd_putc,"%c%c procent",sig[9],sig[10]);
39  
40 if(sig[7]==48)
41 {
42 lcd_gotoxy(7,4);
43 printf(lcd_putc,"baterie");
44 }
45 else
46 {
47 lcd_gotoxy(9,4);
48 printf(lcd_putc,"sit");
49 }
50  
51 delay_ms(2500);
52  
53 }
54 }