VB6串口通讯问题
vb6吧
全部回复
仅看楼主
level 1
zhbloves 楼主
描述:我有两个485通讯查询需求,第一条指令“01 03 00 00 00 01 84 0A”,第二条“01 01 00 00 00 08 3D CC“
发出第一条指令,接收到一串16进制数据,存到文本框“text1”,间隔1秒,然后发出第二条指令,接收到一串16进制数据,存到“text2”,间隔1秒再发第一条,覆盖到文本框“text1”,间隔1秒再发第二条,覆盖到文本框“text2”,如此一直重复,
用VB6的MSComm控件
2022年02月05日 06点02分 1
level 1
dim step as integer
sub timer1_timer() 'interval=500ms
select case step
case 0
发送指令01 03 00 00 00 01 84 0A
case 1
text1=收到的消息
case 2,3
什么也不做,实现1秒间隔
case 4
发送指令01 01 00 00 00 08 3D CC
case 5
text2=收到的消息
case 6,7
什么也不做,实现1秒间隔
end select
step=step+1
if step>=8 then step=0
end sub
2022年03月06日 03点03分 2
1