展开全部
新建VB工程,界面上放一个Text1, 一个MSComm1控件。
Private Sub Form_Load()
MSComm1.CommPort = 1
MSComm1.Settings = "115200,n,8,1"
MSComm1.InBufferCount = 0
MSComm1.RThreshold = 1
MSComm1.InputLen = 0
If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
ins = ""
End Sub
Private Sub MSComm1_OnComm()
ins = ins & MSComm1.Input
MSComm1.InputLen = 0
MSComm1.InBufferCount = 0
Text1.Text = ins
End Sub
该程序即接收单片机从串口来的数据,并显示在Text1上
Private Sub Form_Load()
MSComm1.CommPort = 1
MSComm1.Settings = "115200,n,8,1"
MSComm1.InBufferCount = 0
MSComm1.RThreshold = 1
MSComm1.InputLen = 0
If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
ins = ""
End Sub
Private Sub MSComm1_OnComm()
ins = ins & MSComm1.Input
MSComm1.InputLen = 0
MSComm1.InBufferCount = 0
Text1.Text = ins
End Sub
该程序即接收单片机从串口来的数据,并显示在Text1上
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询