现在按照1.22V,程序计算的的结果与实际电压有偏差。。另外“ADC_Bandgap_VDD”这段DEMO程序计算band-gap voltage的方法有点看不明白,规格书相关的东西,也没有详细说明。但通过这个代码来看,band-gap voltage好像不是恒定的啊。有些困惑,请求帮助。 void READ_BANDGAP() { UINT8 BandgapHigh,BandgapLow; double Bandgap_Value; set_IAPEN; IAPAL = 0x0C; IAPAH = 0x00; IAPCN = READ_UID; set_IAPGO; BandgapHigh = IAPFD; IAPAL = 0x0d; IAPAH = 0x00; IAPCN = READ_UID; set_IAPGO; BandgapLow = IAPFD; BandgapLow = BandgapLow&0x0F; clr_IAPEN; Bandgap_Value = (BandgapHigh<<4)+BandgapLow; Bandgap_Voltage = 3072/(0x0fff/Bandgap_Value); }
|