读书人

做一个旧项目的维护看到如下文档看

发布时间: 2013-09-05 16:02:06 作者: rapoo

做一个旧项目的维护,看到如下文档,看不懂,请大家帮忙,谢谢!!!!


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
[解决办法]
2字节最多表示0-65535,再怎么变化也就能表示这么多,这种换算方法一点用都没有

[解决办法]

引用:
1.我也是这么认为的,因为Start to current time = [Bits 0~11] * 16^[Bits 12~15] ms 需要表示的时间很长。
2.但是为什么要用16的A次方,而不是10的A次方?

16的X次方用二进制移位即可
10的X次方用二进制移位能行吗?就算勉强行,比16的X次方计算是不是复杂很多呢?

读书人网 >C语言

热点推荐