请问这个怎么解码?
我从下位机读取上来的字符串是"01460 0025 C4";
0025就是我要的数据,十六进制数,但是这个怎么解啊??
我之前收到的都是八位的例如"3FC0B4C8"我写了个函数解析出来是1.505正确的
但是四位的这个我写的函数解不出来,修改也不行,可能是我方法不对,这个值地址没错的话应该是秒数,是个integer
求大神相助,我不知道怎么算。。。
Public Function Analysis_Time(BString As String) Dim Ttimes As Integer Dim Ttimem As Integer Dim Ttimeh As Integer Dim a(1 To 3) As String Dim b(1 To 4) As String Dim i As Integer Dim j As Integer For i = 0 To 2 a(i + 1) = "&H" & Mid(BString, 7 + i * 4, 4) Next i For i = 1 To 4 b(i) = Mid(a(1), i + 2, 1) Next Ttimes = 16 ^ 3 * Val("&H" & b(1)) + 16 ^ 2 * Val("&H" & b(2)) + 16 ^ 1 * Val("&H" & b(3)) + Val("&H" & b(4)) Debug.Print Ttimes For i = 1 To 4 b(i) = Mid(a(2), i + 2, 1) Next Ttimem = 16 ^ 3 * Val("&H" & b(1)) + 16 ^ 2 * Val("&H" & b(2)) + 16 ^ 1 * Val("&H" & b(3)) + Val("&H" & b(4)) Debug.Print Ttimem For i = 1 To 4 b(i) = Mid(a(3), i + 2, 1) Next Ttimeh = 16 ^ 3 * Val("&H" & b(1)) + 16 ^ 2 * Val("&H" & b(2)) + 16 ^ 1 * Val("&H" & b(3)) + Val("&H" & b(4)) Debug.Print Ttimeh Text4.Text = Ttimeh & ":" & Ttimem & ":" & Ttimes End Function