自制N32WB031电路板 使用 N32WB03x_1.3.3.zip 的 ADC_SingleRead和ADC_16Bit例程
问题反馈:
ADC_SingleRead采样数据与测量基本符合,但精度偏低,ADC_16Bit则偏差很大,基本上直接读取到的ADC_DAT差一大截,完全不是6bit的量化误差,转换成电压也差了很多。请问是16bit采集是不是有什么错误。
为方便比较,对测试代码做了简单修改,直接测量CH6即VCC电源电压,测量为同一块电路板,VCC电压确定一直,ADC_SingleRead,调试输出为
this is adc single read Demo.
Please make sure J15 and J16 connect the IO to pin on board!
ADC CH6 value: 843(53952) | ADC CH6 vol_mV: 3443 .
ADC CH6 value: 842(53888) | ADC CH6 vol_mV: 3439 .
()内的数值是10bit放大到16bit,方便对比后面的16bit 输出
ADC_16Bit 调试输出为
this is 16bit adc read Demo.
Please make sure J15 and J16 connect the IO to pin on board!
CH2 is PB9 which is support 0-1V.
CH3 is PB8 which is support 0-3.6V.
ADC16Bit offset:-115
Single Read CH6,value: 22422(55190), vol_mV: 3527
Single Read CH6,value: 22499(55267), vol_mV: 3533
不考虑补偿,10bit采集843,换算成16bit 53952 ,16bit 采集22422 换算成无符号55190差值 1238,远超过6位的量化误差64,使用起来16bit就是完全不可用的状态。
实际代码ADC_16Bit用VCC校准,后续补偿的问题,测量值越小,补偿会越错。比如CH3通道测量值0.3v,16bit代码测试结果
this is 16bit adc read Demo.
Please make sure J15 and J16 connect the IO to pin on board!
CH2 is PB9 which is support 0-1V.
CH3 is PB8 which is support 0-3.6V.
ADC16Bit offset:-119
Single Read CH3,value: -26756(6012), vol_mV: 58
Single Read CH3,value: -26753(6015), vol_mV: 58
Single Read CH3,value: -26740(6028), vol_mV: 59
10bit的ADC_SingleRead测试如下:
this is adc single read Demo.
Please make sure J15 and J16 connect the IO to pin on board!
ADC CH3 value: 119(7616) | ADC CH3 vol_mV: 286 .
ADC CH3 value: 118(7552) | ADC CH3 vol_mV: 282 .
ADC CH3 value: 120(7680) | ADC CH3 vol_mV: 291 .
比较采集原始数据为7616对比6012 差值1604
|