signed long Ad_curr;
signed long Av_curr;
signed int Buf=0; //变量
Av_curr = 0;
/*----------------------------------------------------------------------------
电池的电压
----------------------------------------------------------------------------*/
void Get_Batt_Volt()
{
Ad_curr = Getadc(2); //读取端口2电压值;
Buf = Av_curr / 75;
Av_curr = Av_curr - Buf;
Av_curr = Av_curr + Ad_curr; //输出Av_curr
} |