请问 ADC 转换公式下面的 NUM =NUM *29.1/9.9;代表着什么呢
NUM = (Num * 4.68/ 1024.0); //计算公式:10-bit A/D Conversion Result = 1024 x (Vin / Vcc)
NUM =NUM *29.1/9.9;
原始代码
LcdDisp(ldata,GetADCResult(7)); //液晶1602显示输入电压值和AD采集电压值(P1.7)
************************************************************************************************
uint GetADCResult(uchar ch)
{
ADC_CONTR = ADC_POWER | ADC_SPEEDLL | ch | ADC_START;
_nop_(); //Must wait before inquiry
_nop_();
_nop_();
_nop_();
while (!(ADC_CONTR & ADC_FLAG)); //Wait complete flag
ADC_CONTR &= ADC_FLAG; //Close ADC
return (ADC_RES*4 + ADC_RESL); //Return ADC result
}
void Num_to_Disp(uint i, uint Num)
{
int xx, yy, zz;
NUM = (Num * 4.68/ 1024.0); //计算公式:10-bit A/D Conversion Result = 1024 x (Vin / Vcc)
NUM =NUM *29.1/9.9;
xx = (int)NUM;
yy = (int)((NUM - (float)(xx)) * 10);
zz = (int)((NUM - (float)(xx)) * 100)%10;
*************************************************************************************************
|