帮忙查看项目SPEC的奇怪数据表示法!!!!!
做一个旧项目的维护,看到如下文档,看不懂,请大家帮忙,谢谢!!!!
Value: Several fields with the following structure:
1. Status (8 bits unsigned)
0. Finished
1. Busy
2. Error
3. Unable to measure (not enough power)
4. Unstable signal power
2. Start to Finish time * ms (16 bits)
Bits 0~11: *ms, unsigned
Bits 12~15: *16^, signed
Start to Finish time = [Bits 0~11] * 16^[Bits 12~15] ms
3. Start to current time * ms (16 bits)
Bits 0~11: *ms, unsigned
Bits 12~15: *16^, signed
Start to current time = [Bits 0~11] * 16^[Bits 12~15] ms
==》这里的16^[Bits 12~15]是什么意思?是指数表示法?为什么是16^而不是10^
比如:下命令到现在的时间为1小时,则
计算:1*60*60*1000=3600 000
Bits 0~11: *ms, 应该为:b1110 0001 0000
Bits 12~15: *16^, 应该为:b0011
Start to current time = [Bits 0~11] * 16^[Bits 12~15] ms
Start to current time:3E10
看代码,好像不对。
文档解释如下,可是大于[bit0-bit11]就不知道怎么表达了,用指数形式吗?
At 11:00:21 set gain from 7dB to 6dB, assume gain settle at 1200ms. ”set busy” pin as busy
At 11:00:22 cmd 0x00 00 response busy 01 0000 3E80
At 11:00:22:2 ”set busy” pin as finish
At 11:00:31 cmd 0x00 00 response finished 00 4B00 2711
[解决办法]
1200ms
十六进制为04B0 其中 [Bits 0~11] 4B0 [Bits 12~15] 0
那么传输的数据格式为 [Bits 0~11] * 16^[Bits 12~15] ms
4B0*16^0 = 4B00