首页 > 开发 > 综合 > 正文

VB PDU mode 7 bit 解码

2024-07-21 02:20:52
字体:
来源:转载
供稿:网友
dim tep as string
dim temp as string
dim i as integer
dim b as integer
dim rems as string
tep = rmsg
i = len(tep)
if i < 1 then exit function

b = i / 2

if i = b * 2 then
tep = left(tep, b * 2)
else
b = b - 1
tep = left(tep, b * 2)
end if

chg7 = ""
rems = ""
dim trint as integer
dim strtmp as string

trint = 1
strtmp = ""

for i = 1 to b
temp = "&h" & mid(tep, (i - 1) * 2 + 1, 2)
temp = d_to_b(val(temp)) '转二进制

if len(temp) < 8 then
temp = strpla(8 - len(temp)) + temp
end if

strtmp = mid(temp, trint + 1, 8 - trint) + rems

rems = mid(temp, 1, trint)


chg7 = chg7 & chrw(cint(val(b_to_d(strtmp))))

trint = trint + 1
if trint = 8 then
trint = 1
chg7 = chg7 & chrw(cint(val(b_to_d(rems))))
rems = ""
end if


next i


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表