= 0x00; BandgapLow = IAPFD; IAPAL = 0x0e; IAPAH = 0x00; BandgapHigh = IAPFD; clr_IAPEN; BandgapMark = (BandgapHigh<<8) + BandgapLow; set_IAPEN; IAPCN = READ_UID; IAPAL = 0x0f; IAPAH = 0x00; BandgapLow = IAPFD; IAPAL = 0x10; IAPAH = 0x00; BandgapHigh = IAPFD; clr_IAPEN; Bandgap_Value = ((BandgapHigh<<8) + BandgapLow)*3.3/4096;//精确计算值 Bandgap_Voltage_Temp = Bandgap_Value * 1000;//单位转换,转为mV if((Bandgap_Voltage_Temp<1100)||(Bandgap_Voltage_Temp>1300)){ Bandgap_Value = 1200.0; //如果测出来的值不在指定范围内,就用典型值1200mV代替 } g_u16Bandgap_Value = (uint16_t)(Bandgap_Value*10);}
有两个ROM存储在N76E003芯片中,一个是校准值存储ROM,另一个是代码存储ROM。这里读取两个ROM是为了保证读取的是校准值存储ROM中的间隙电压值。另外,条件选取则是为了确保读取的值在指定范围内。如果读取值不在指定范围内,则使用典型值1200mV代替,保证计算的精确性。
= 0x00; BandgapLow = IAPFD; IAPAL = 0x0e; IAPAH = 0x00; BandgapHigh = IAPFD; clr_IAPEN; BandgapMark = (BandgapHigh<<8) + BandgapLow; set_IAPEN; IAPCN = READ_UID; IAPAL = 0x0f; IAPAH = 0x00; BandgapLow = IAPFD; IAPAL = 0x10; IAPAH = 0x00; BandgapHigh = IAPFD; clr_IAPEN; Bandgap_Value = ((BandgapHigh<<8) + BandgapLow)*3.3/4096;//精确计算值 Bandgap_Voltage_Temp = Bandgap_Value * 1000;//单位转换,转为mV if((Bandgap_Voltage_Temp<1100)||(Bandgap_Voltage_Temp>1300)){ Bandgap_Value = 1200.0; //如果测出来的值不在指定范围内,就用典型值1200mV代替 } g_u16Bandgap_Value = (uint16_t)(Bandgap_Value*10);}
有两个ROM存储在N76E003芯片中,一个是校准值存储ROM,另一个是代码存储ROM。这里读取两个ROM是为了保证读取的是校准值存储ROM中的间隙电压值。另外,条件选取则是为了确保读取的值在指定范围内。如果读取值不在指定范围内,则使用典型值1200mV代替,保证计算的精确性。
举报