151 |
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 |
|
|
|
29 |
while(TRUE) |
|
|
30 |
{ |
|
|
31 |
printf("AT+CBC\r"); |
|
|
32 |
gets(sig); |
|
|
33 |
getc(); |
|
|
34 |
gets(sig); |
|
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
lcd_gotoxy(5,2); |
|
|
39 |
printf(lcd_putc,"%c%c procent",sig[9],sig[10]); |
|
|
40 |
delay_ms(2500); |
|
|
41 |
|
|
|
42 |
} |
|
|
43 |
} |