
#ifndef ADC_ODPOR_BATERIE_TEPLOTA_H
#define	ADC_ODPOR_BATERIE_TEPLOTA_H

//************************ADC******************
typedef enum
{
   battery_adc
   ,ohm_adc
}channel;

__bit ADC_ready = 0; //jestli je adc kanal ready (200ms cekani)
__bit new_meas_ready = 0; //jestli muzu zacit merit znova pri zhaveni
__bit poprve = 0; // flag jestli se mereni odporu dela poprve
__bit zmena = 0; //flag pro mereni odporu jestli doslo ke zmene spiralky
__bit battery_check = 0; // flag pro mereni napeti baterie

unsigned int meas_count=0; // Perioda mereni odporu pri TC nebo normalnim zhaveni kvuli zkratu  
unsigned int batt_read_count = 0;
unsigned int V_bat = 0; // napeti baterie
char temp0 = 0; //teplota z temperature modulu
unsigned int adc_res; // vysledek z ADC prevodu
unsigned int seg_adc_count=0; // pocitadlo pro interval mereni nove hodnoty odpotu
unsigned int adc_switch=0; //delay na switch mezi adc kanaly
unsigned int coil_res = 0; //odpor spiralky
unsigned int coil_res0 = 0; //odpor spiralky p?i teplot? okoli (pri T0)
unsigned int coil_res1 = 0; // vypocteny odpor spiralky p?i nastavene teplot? (pri T1)
unsigned int coil_res_disp =0;//odpor spiralky na segment display
unsigned long Vout = 0; //vystupni napeti
unsigned int coil_res_disp1 = 0;

void adc_init(void);
void venek_temp(void);
void battery_read(void);
void ohm_read(void);
void get_coil_res(void);
void check_adc_channel(channel channelx);
unsigned int coil_res1_vypocet(unsigned int T1);



#endif	/* ADC_ODPOR_BATERIE_TEPLOTA_H */

