TI中文支持网
TI专业的中文技术问题搜集分享网站

ADS1118驱动程序测量负温度

应用中需要测量负温度,ti的430BOOST-ADS1118-SFT驱动程序里边的一点注释没看懂。主要是Code[]这个数组是怎么得来的,不懂的部分我加了下划线,请大家帮忙看一下。

/******************************************************************************
* function: local_compensation(int local_code)
* introduction:
* this function transform internal temperature sensor code to compensation code, which is added to thermocouple code.
* local_data is at the first 14bits of the 16bits data register.
* So we let the result data to be divided by 4 to replace right shifting 2 bits
* for internal temperature sensor, 32 LSBs is equal to 1 Celsius Degree.
* We use local_code/4 to transform local data to n* 1/32 degree.
* the local temperature is transformed to compensation code for thermocouple directly.
* (Tin -T[n-1])
* comp codes = Code[n-1] + (Code[n] – Code[n-1])* {—————}
* (T[n] – T[n-1])
* for example: 5-10 degree the equation is as below
*
* tmp = (0x001A*(local_temp – 5))/5 + 0x0019;
*
* 0x0019 is the 'Code[n-1]' for 5 Degrees; 0x001A = (Code[n] – Code[n-1])
* (local_temp – 5) is (Tin -T[n-1]); denominator '5' is (T[n] – T[n-1])
*
* the compensation range of local temperature is 0-125.
* parameters: local_code, internal sensor result
* return value: compensation codes
******************************************************************************/

user151383853:

其实就是从 ADC 的结果变换成温度

这里这是有个移位运算可能影响负数。不过移位的是 ADC 的结果,也不会影响

赞(0)
未经允许不得转载:TI中文支持网 » ADS1118驱动程序测量负温度
分享到: 更多 (0)