vb 串口 接收 程序

[复制链接]
查看11 | 回复3 | 2013-9-6 08:24:22 | 显示全部楼层 |阅读模式
Private Sub Form_Load()
MSComm1.CommPort = 1
MSComm1.Settings = " 9600,n,8,1"
MSComm1.InputMode = comInputModeBinary
MSComm1.InputLen = 0
MSComm1.SThreshold = 1
MSComm1.RThreshold = 1
MSComm1.PortOpen = True
Text5 = ""End SubPrivate Sub MSComm1_OnComm()
Dim buffer As Variant
Dim arr() As Byte
Dim...
回复

使用道具 举报

千问 | 2013-9-6 08:24:22 | 显示全部楼层
Dim arr() As Byte, I as IntegerSelect Case MSComm1.CommEventCase comEvReceive arr = MSComm1.Input For I = 0 to UBound(arr)
Text5.Text = Text5.Text + " || " + Hex(arr(I)) ...
回复

使用道具 举报

千问 | 2013-9-6 08:24:22 | 显示全部楼层
一般,MSComm 关键属性如RThreshold才设置,其他都可以用默认值楼上 楼下都给了例子,都不错...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行