// вгв
#ifndef _MEASURE
#define _MEASURE

interrupt void cpu_timer1_isr_SENS(void);

void Init_sensors(void);
void Init_packMask(void);
void Temper_count(int chan);
void calc_sensor_koef();

typedef union
{
	struct
	{
		unsigned int Tear	:1;
		unsigned int Stick	:1;
		unsigned int Wry	:1;
		unsigned int Out	:1;
		unsigned int Over	:1;
		unsigned int Hyper	:1;
		unsigned int Contr1	:1;
		unsigned int Contr2	:1;

		unsigned int Stop	:1;
		unsigned int Ready	:1;
		unsigned int res	:2;
		unsigned int Imit   :1;
		unsigned int Latch	:1;
		unsigned int Ignor	:1;
		unsigned int Bypas	:1;

	} bit;
	unsigned int all;

} ERROR;

typedef union
{
	struct
	{
		unsigned int Error		:1;
		unsigned int Alarm		:1;
		unsigned int OverHeat	:1;
		unsigned int SubHeat	:1;
		unsigned int OutHeat	:1;
		unsigned int Test_lamp	:1;

	} bit;
	unsigned int all;

} FLAG;

#define NOER	0xF000
#define EROR	0x01FF

#define READY_FREQ	1000.0	// Гц
#define BLINK_FREQ	2		// Гц
#define	BLINK_TIME (READY_FREQ / BLINK_FREQ)

#define ADC_FREQ	3750	//3885//777//2000//20000	//777	//3885	// Гц (777*5)

#define SENS_ERR_WAIT	10

#define CANPOWSE (READY_FREQ * 2 / 100)	//	0.1 сек

#define maximum_bright	10

#define C100	1000
#define C150	1500

#define	Cooling		5		// (°С) Гистерезис по снатию перегрева

#define COSPi6	0.86602540378443864676372317075294

#define RADIX2	1.4142135623730950488016887242097

#define	CURRENT		1	// ток
#define	VOLTAGE		2	// напражение
#define POWER_380	3	// питание 380В
#define POWER_220	4	// питание 220В
#define POWER_31	5	// питание 31В
#define POWER_24	6	// питание 24В
#define VIRT_24		7	// питание 24В
#define POWER_15	8	// питание 15В
#define TERMO_AD	9	// термодатчик мелкосхема
#define TERMO_RS	10	// термодатчик резистор

extern int GOOD[];

extern int TPL_CANS,tpl_cans;

extern FLAG chk,sig;

extern FILTERBAT adc_filter[];
extern float out_filter[];

extern float tmpK1,tmpK2;

extern int adc0[],tmp0[];
extern float tmpK[];
extern int sens_type[];

extern unsigned long LoneLeft,LoneRite;
extern unsigned long Caliber_time;
extern unsigned int CanPowse,CanGO;
extern long WAKE;

#endif 	//_MEASURE
