TI论坛
直播中

李琴

7年用户 207经验值
私信 关注
[问答]

请问BQ20Z45 CC Gain CC Delta怎么计算?

读取BQ20Z45,地址0x68,中对应的数据CC Gain = 3.04  -> 0x82 46 4B 73,CC Delta = 3.04 -> 0x94 61 9D 86,但是其并不是标准的浮点数计算方法,
那么请是怎么计算出来的,找了之前2015年的帖子,BQ34Z100的,但是好像不适合BQ20Z45
能麻烦ti的工程是帮忙解答一下吗?

回帖(1)

马昱

2019-3-26 16:39:18
CC Gain:   data flash raw data 0x7F71205C, EVSW reading with: 10.124
Raw data (0x7F71205C) -> first two byte is for exp gain. The exp is 0x7F -> 127, so gain:  (127-128-24) = -25 -> 2^(-25)
 
The rest is the low address to high address hex read from gauge and it is big endian. Bit 7 of the MSB is used for the sign bit, but in the conversion the mantissa is considered to be shifted so the bit 7 would always be a 1, to preserve the most possible significant bits in the mantissa.  So after determining the sign here, the implied high bit must be set back to one for the conversion to be correct.
 
0x71205C OR with 0x80 = 0xF1205C -> convert into DEC and times 2^(-25) = 15802460*2^(-25) = 0.47095
CC Gain  = 4.768/x = 4.768/0.47095 = 10.124  (matches!)
 

CC Delta:   data flash raw data 0x940898C0, EVSW reading: 10.147
 
Raw data (0x940898C0) -> first two byte is for exp gain. The exp is 0x94 -> 148, so gain = (148-128-24) = -4
0x0898C0 OR with 0x80 = 0x8898C0 -> convert into DEC and times 2^-4 = 559500
CC delta = 5677445/x = 5677445/559500 = 10.147

 
Board Offset: data flash raw data 0xF6.  EVSW reading : -0.27
F6 -> convert to DEC = -9.
Board offset = x*0.48/16 = -9*0.48/16 = -0.27

 
CC Offset:  data flash raw data 0xFA89, EVSW reading with new *.encr = -0.67
0xFA89 -> convert to DEC = -1398.
CC offset = x*0.00048 = -1398*0.00048 = -0.67
举报

更多回帖

发帖
×
20
完善资料,
赚取积分