在线时间2221 小时
UID3253523
注册时间2016-3-21
NXP金币2880
该用户从未签到
超级版主
 
- 积分
- 24890
- 最后登录
- 2025-7-21
|
发表于 2017-4-19 13:33:37
|
显示全部楼层
楼主你好!
关于ADC的硬件平均,你可以参考KL25 参考手册:
28.4.4.7 Hardware average function
The hardware average function can be enabled by setting SC3[AVGE]=1 to perform a hardware average of multiple conversions. The number of conversions is determined by the AVGS[1:0] bits, which can select 4, 8, 16, or 32 conversions to be averaged. While
the hardware average function is in progress, SC2[ADACT] will be set.
After the selected input is sampled and converted, the result is placed in an accumulator from which an average is calculated once the selected number of conversions have been completed. When hardware averaging is selected, the completion of a single conversion will not set SC1n[COCO].
If the compare function is either disabled or evaluates true, after the selected number of conversions are completed, the average conversion result is transferred into the data result registers, Rn, and SC1n[COCO] is set. An ADC interrupt is generated upon the setting of SC1n[COCO] if the respective ADC interrupt is enabled, that is, SC1n[AIEN]=1.
也就是如果使能硬件平均之后,硬件会自己做平均之后,把平均好的值放到数据寄存器,标志置位。
所以,如果你要切换通道,建议你使用代码换通道,然后采集等待采集完成,这样不会导致信号混乱。
|
|