这段代码如何写成VB6的?
a(0)=(short(Re_buf(3)<<8|Re_buf(2)))/32768.0*16;a[1]=(short(Re_buf[5]<<8|Re_buf[4]))/...
a(0) = (short(Re_buf (3)<<8| Re_buf (2)))/32768.0*16;
a[1] = (short(Re_buf [5]<<8| Re_buf [4]))/32768.0*16;
a[2] = (short(Re_buf [7]<<8| Re_buf [6]))/32768.0*16;
T = (short(Re_buf [9]<<8| Re_buf [8]))/340.0+36.25; 展开
a[1] = (short(Re_buf [5]<<8| Re_buf [4]))/32768.0*16;
a[2] = (short(Re_buf [7]<<8| Re_buf [6]))/32768.0*16;
T = (short(Re_buf [9]<<8| Re_buf [8]))/340.0+36.25; 展开
1个回答
展开全部
其中的Re_buf 是什么类型的数据?short类型是几位的?
追问
unsigned char Re_buf[11],counter=0;short类型程序里没指明
追答
这是用的什么编译器(编程软件)?下面设short占2个字节,第一个语句改写为:
所有的问题,主要就是圆括号内的值的计算。下面通过增加一个自定义函数来解决:
a(0) = abc(Re_buf(3), Re_buf(2)) / 32768# * 16
a(1) = abc(Re_buf(5), Re_buf(4)) / 32768# * 16
a(2) = abc(Re_buf(7), Re_buf(6)) / 32768# * 16
T = abc(Re_buf(9), Re_buf(8)) / 340# + 36.25
Function abc(x As Integer, y As Integer) As Integer
Dim w As Long
w = x * 256& Or y
If w <= 32767 Then abc = w Else abc = w - 65536
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询