在线时间514 小时
UID2025756
注册时间2013-7-16
NXP金币0
该用户从未签到
金牌会员
 
- 积分
- 9267
- 最后登录
- 1970-1-1
|
发表于 2015-3-30 13:06:02
|
显示全部楼层
硬件平均得到的结果就是累加并算好的了,不需要你软件去平均了。
具体你可以查看reference manual ADC章节的介绍:
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.
|
|