33.800.00是多少钱
答案:2 悬赏:60 手机版
解决时间 2021-03-09 04:32
- 提问者网友:遁入空寂
- 2021-03-08 13:06
33.800.00是多少钱
最佳答案
- 五星知识达人网友:神的生死簿
- 2021-03-08 14:44
你确定不是33,800.00
全部回答
- 1楼网友:老鼠爱大米
- 2021-03-08 15:00
public strsendtext as string '发送的文本
public bytsendbyte() as byte '发送二进制数据
public bytreceivebyte() as byte '接收到的字节
public intreceivelen as integer '接收到的字节数
public strhex as string '接收到的字符串
private sub form_load()
'串口初始化
if mscom.portopen then mscom.portopen = false
mscom.outbuffersize = 512
mscom.inputmode = 1 '读取数据的格式,二进制
mscom.inbuffercount = 0 '清除接收缓冲区
mscom.inbuffersize = 256
end sub
public sub getdisplaytext()
dim intvalue as integer
dim inthighhex as integer
dim intlowhex as integer
dim n as integer
for n = 1 to intreceivelen
intvalue = bytreceivebyte(n - 1)
inthighhex = intvalue \ 16
intlowhex = intvalue - inthighhex * 16
if inthighhex < 10 then
inthighhex = inthighhex + 48
else
inthighhex = inthighhex + 55
end if
if intlowhex < 10 then
intlowhex = intlowhex + 48
else
intlowhex = intlowhex + 55
end if
strhex = strhex + chr$(inthighhex) + chr$(intlowhex)
next n
end sub
public sub inputmanage(bytinput() as byte, intinputlenth as integer)
dim n as integer '定义变量及初始化
redim preserve bytreceivebyte(intreceivelen + intinputlenth)
for n = 1 to intinputlenth step 1
on error resume next
bytreceivebyte(intreceivelen + n - 1) = bytinput(n - 1)
next n
intreceivelen = intreceivelen + intinputlenth
end sub
public function strhextobytearray(strtext as string, bytbyte() as byte) as integer
dim hexdata as integer '十六进制(二进制)数据字节对应值
dim hstr as string * 1 '高位字符
dim lstr as string * 1 '低位字符
dim highhexdata as integer '高位数值
dim lowhexdata as integer '低位数值
dim hexdatalen as integer '字节数
dim stringlen as integer '字符串长度
dim account as integer '计数
dim n
' strtext = "" '设初值
hexdatalen = 0
strhextobytearray = 0
stringlen = len(strtext)
account = stringlen \ 2
redim bytbyte(account)
for n = 1 to stringlen
do '清除空格
hstr = mid(strtext, n, 1)
n = n + 1
if (n - 1) > stringlen then
hexdatalen = hexdatalen - 1
exit for
end if
loop while hstr = " "
do
lstr = mid(strtext, n, 1)
n = n + 1
if (n - 1) > stringlen then
hexdatalen = hexdatalen - 1
exit for
end if
loop while lstr = " "
n = n - 1
if n > stringlen then
hexdatalen = hexdatalen - 1
exit for
end if
highhexdata = converthexchr(hstr)
lowhexdata = converthexchr(lstr)
if highhexdata = -1 or lowhexdata = -1 then '遇到非法字符中断转化
hexdatalen = hexdatalen - 1
exit for
else
hexdata = highhexdata * 16 + lowhexdata
bytbyte(hexdatalen) = hexdata
hexdatalen = hexdatalen + 1
end if
next n
if hexdatalen > 0 then '修正最后一次循环改变的数值
hexdatalen = hexdatalen - 1
redim preserve bytbyte(hexdatalen)
else
redim preserve bytbyte(0)
end if
if stringlen = 0 then '如果是空串,则不会进入循环体
strhextobytearray = 0
else
strhextobytearray = hexdatalen + 1
end if
end function
'**********************************
'字符表示的十六进制数转化为相应的整数
'错误则返回 -1
'**********************************
public function converthexchr(str as string) as integer
dim test as integer
test = asc(str)
if test >= asc("0") and test <= asc("9") then
test = test - asc("0")
elseif test >= asc("a") and test <= asc("f") then
test = test - asc("a") + 10
elseif test >= asc("a") and test <= asc("f") then
test = test - asc("a") + 10
else
test = -1 '出错信息
end if
converthexchr = test
end function
sub subsend
dim longth as variant
mscom.inbuffercount = 0 '清除接收缓冲区
if mscom.portopen then mscom.portopen = false
mscom.inputmode = 1
mscom.commport = 1
mscom.inputlen = 20
mscom.rthreshold = 20
mscom.settings = "9600,n,8,1"
if not mscom.portopen then mscom.portopen = true
longth = strhextobytearray(strsendtext, bytsendbyte())
if longth > 0 then
mscom.output = bytsendbyte
end if
end sub
private sub mscom_oncomm()
dim bytinput() as byte
dim i as integer
dim j as integer
strhex = ""
intreceivelen = 0
select case mscom.commevent
case comevreceive
redim bytinput(intlen)
bytinput = mscom.input
call inputmanage(bytinput, intlen)
call getdisplaytext
redim buf(intlen)
debug.print strhex
end select
end sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯