// вгв
#ifndef _MEASURE
#define _MEASURE

interrupt void cpu_timer1_isr_SENS(void);

void Init_sensors(void);
void Init_optic(void);
void Init_packMask(void);
void Temper_count(int chan);
void Current_count(int chan);
void Power_count(int chan);

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	:3;
		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	0xE000
#define EROR	0x01FF

#define READY_FREQ	1000	// Гц
#define BLINK_FREQ	2		// Гц
#define ADC_FREQ	3000//3125 //3750//5000//3885//777//2000//20000	//777	//3885	// Гц (777*5)
#define DAC_FREQ	50		// Гц

#define LOAD_TIME	10		// sec

#define CANPOWSE	((READY_FREQ * 2) / 100)	//	10 ms

#define SENS_ERR_WAIT	10

#define maximum_bright	10

//#define ZERO	27

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

#define COSPi6	0.86602540378443864676372317075294

#define RADIX2	1.4142135623730950488016887242097

#define	CURRENT		1	// ток
#define	VOLTAGE		2	// напражение
#define TERMO_AD	3	// термодатчик мелкосхема
#define TERMO_RS	4	// термодатчик резистор

extern int MAX_TPL_CANAL;

extern FILTERBAT filter[];

extern ERROR * sens_error;
extern int * sens_data;
extern int * sens_hi_edge;
extern int * sens_lo_edge;

extern int adc0[],tmp0[];

extern float tmpK[];
extern FLAG chk,sig;
extern int sens_type[];

extern float zer_count[];

extern int period_ready;
extern unsigned int CanPowse,CanGO;
extern unsigned int Maska[][8];

#endif 	//_MEASURE
