社区导航

 

搜索
查看: 591|回复: 1

[求助] 如何计算OFS的参数以在AD结果中减掉一个数值

[复制链接]

96

TA的帖子

2

TA的资源

一粒金砂(中级)

Rank: 2

发表于 2017-7-27 16:27:49 | 显示全部楼层 |阅读模式
哪位计算过KW41Z的ADC的OFS,请帮忙算一下要在AD结果中减掉179个数值,OFS的数值应该设置多少?AD结果的位数是12位。
下面的文档中的说明,我只看明白了如何在OFS增加数值,没有看明白如何减小数值。
最好能举例说明一下,谢谢!

28.4.7 User-defined offset function
OFS contains the user-selected or calibration-generated offset error correction value.
This register is a 2’s complement, left-justified. The value in OFS is subtracted from the
conversion and the result is transferred into the result registers, Rn. If the result is greater
than the maximum or less than the minimum result value, it is forced to the appropriate
limit for the current mode of operation.
The formatting of the OFS is different from the data result register, Rn, to preserve the
resolution of the calibration value regardless of the conversion mode selected. Lower
order bits are ignored in lower resolution modes. For example, in 8-bit single-ended
mode, OFS[14:7] are subtracted from D[7:0]; OFS[15] indicates the sign (negative
numbers are effectively added to the result) and OFS[6:0] are ignored. The same bits are
used in 9-bit differential mode because OFS[15] indicates the sign bit, which maps to
D[8]. For 16-bit differential mode, OFS[15:0] are directly subtracted from the conversion
result data D[15:0]. In 16-bit single-ended mode, there is no field in the OFS
corresponding to the least significant result D[0], so odd values, such as -1 or +1, cannot
be subtracted from the result.

The offset calibration function may be employed by the user to remove application
offsets or DC bias values. OFS may be written with a number in 2's complement format
and this offset will be subtracted from the result, or hardware averaged value. To add an
offset, store the negative offset in 2's complement format and the effect will be an
addition. An offset correction that results in an out-of-range value will be forced to the
minimum or maximum value. The minimum value for single-ended conversions is
0x0000; for a differential conversion it is 0x8000.


回复

使用道具 举报

96

TA的帖子

2

TA的资源

一粒金砂(中级)

Rank: 2

 楼主| 发表于 2017-7-27 17:19:49 | 显示全部楼层
研究出来了,不需要回复了。


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

  • 论坛活动 E手掌握

    扫码关注
    EEWORLD 官方微信

  • EE福利  唾手可得

    扫码关注
    EE福利 唾手可得

Archiver|手机版|小黑屋|电子工程世界 ( 京ICP证 060456 )

GMT+8, 2019-1-23 08:03 , Processed in 0.095560 second(s), 16 queries , Gzip On, MemCache On.

快速回复 返回顶部 返回列表