void bat() 
{
//float Vop= 100*(float)(1.1*16368)/Vbg() ;
float Vop= 100*(float)(1.1*15738)/Vbg() ;
//int u=Vop;    
vc=int(Vop)/100;
vd=int(Vop)%100;
}
//****************************** 
int Vbg() {  
ADMUX = (1<<REFS0)|(0<<REFS1)|(1<<MUX3)|(1<<MUX2)|(1<<MUX1)|(0<<MUX0);
long buffersamp=0;
for (int n=0x0; n<=0xff; n++ ) {
ADCSRA |= (1<<ADSC)|(1<<ADEN);  //Starts a new conversion
//ADCSRA = 0xc7;
while (bit_is_set(ADCSRA,ADSC));
buffersamp += ADC; }
buffersamp >>=4; //16368 full scale 14bit
ADCSRA &= ~(1 << ADEN);  // отключаем АЦП
return buffersamp;
}
