2953 |
jacho |
1 |
//#include "C:\Users\Honza\Documents\pic\I2C_magnetometr\main.h" |
|
|
2 |
#include "main.h" |
|
|
3 |
#define EEPROM_SDA PIN_C4 |
|
|
4 |
#define EEPROM_SCL PIN_C3 |
2926 |
jacho |
5 |
#use i2c(master, sda=EEPROM_SDA, scl=EEPROM_SCL) |
2953 |
jacho |
6 |
#use rs232(baud=9600,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD |
|
|
7 |
#include "BQ34Z100.h" |
2926 |
jacho |
8 |
|
|
|
9 |
|
|
|
10 |
void main() |
|
|
11 |
{ |
|
|
12 |
|
|
|
13 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
|
|
14 |
setup_adc(ADC_CLOCK_DIV_2); |
|
|
15 |
setup_spi(SPI_SS_DISABLED); |
|
|
16 |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
17 |
setup_timer_1(T1_DISABLED); |
|
|
18 |
setup_timer_2(T2_DISABLED,0,1); |
|
|
19 |
setup_ccp1(CCP_OFF); |
|
|
20 |
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard |
|
|
21 |
|
2953 |
jacho |
22 |
printf("Vycitani zakladnich dat z modulu LION1CELL01B \r\n",); |
|
|
23 |
printf("(c) MLAB 2013 JACHO \r\n",); |
|
|
24 |
int16 data; |
2926 |
jacho |
25 |
|
|
|
26 |
|
|
|
27 |
while(TRUE) |
|
|
28 |
{ |
2953 |
jacho |
29 |
data=batintT(); |
|
|
30 |
printf("Teplota baterie: %Ld (°C)\r\n", data); |
|
|
31 |
data=batNAP(); |
|
|
32 |
printf("Napeti clanku: %Ld (mV)\r\n", data); |
|
|
33 |
data=batPROUD(); |
|
|
34 |
printf("Proud clankem: %Ld (mA)\r\n", data); |
|
|
35 |
data=batKAPAKT(); |
|
|
36 |
printf("Zbyvajici kapacita: %Ld (mAh)\r\n", data); |
|
|
37 |
data=batKAPMAX(); |
|
|
38 |
printf("Max. kapacita: %Ld (mAh)\r\n", data); |
|
|
39 |
data=batSTAV(); |
|
|
40 |
printf("Stav baterie: %Ld (procenta)\r\n", data); |
|
|
41 |
delay_ms (2000); |
2926 |
jacho |
42 |
} |
|
|
43 |
} |