完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
N76E003读取间隙电压的精确计算值时,为什么还要条件选取,读两个rom的值?
例程如下: void READ_BANDGAP() { UINT8 BandgapHigh,BandgapLow,BandgapMark; double Bandgap_Value,Bandgap_Voltage_Temp; set_IAPEN; IAPCN = READ_UID; IAPAL = 0x0d; IAPAH = 0x00; set_IAPGO; BandgapLow = IAPFD; BandgapMark = BandgapLow&0xF0; if (BandgapMark==0x80) { BandgapLow = BandgapLow&0x0F; IAPAL = 0x0C; IAPAH = 0x00; set_IAPGO; BandgapHigh = IAPFD; Bandgap_Value = (BandgapHigh<<4)+BandgapLow; Bandgap_Voltage_Temp = Bandgap_Value*3/4; Bandgap_Voltage = Bandgap_Voltage_Temp - 33; //the actually banggap voltage value is similar this value. } if (BandgapMark==0x00) { BandgapLow = BandgapLow&0x0F; IAPAL = 0x0C; IAPAH = 0x00; set_IAPGO; BandgapHigh = IAPFD; Bandgap_Value = (BandgapHigh<<4)+BandgapLow; Bandgap_Voltage= Bandgap_Value*3/4; } if (BandgapMark==0x90) { IAPAL = 0x0E; IAPAH = 0x00; set_IAPGO; BandgapHigh = IAPFD; IAPAL = 0x0F; IAPAH = 0x00; set_IAPGO; BandgapLow = IAPFD; BandgapLow = BandgapLow&0x0F; Bandgap_Value = (BandgapHigh<<4)+BandgapLow; Bandgap_Voltage= Bandgap_Value*3/4; } clr_IAPEN; // printf ("\n BG High = %bX",BandgapHigh); // printf ("\n BG Low = %bX",BandgapLow); // printf ("\n BG ROMMAP = %e",Bandgap_Voltage); } |
|
相关推荐
1个回答
|
|
= 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代替,保证计算的精确性。 |
|
|
|
只有小组成员才能发言,加入小组>>
3309 浏览 9 评论
2988 浏览 16 评论
3490 浏览 1 评论
9049 浏览 16 评论
4083 浏览 18 评论
1168浏览 3评论
601浏览 2评论
const uint16_t Tab[10]={0}; const uint16_t *p; p = Tab;//报错是怎么回事?
592浏览 2评论
用NUC131单片机UART3作为打印口,但printf没有输出东西是什么原因?
2329浏览 2评论
NUC980DK61YC启动随机性出现Err-DDR是为什么?
1892浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-19 06:30 , Processed in 1.134179 second(s), Total 78, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号