|
(原文件名:12.JPG)
设置不成功 (原文件名:13.JPG)
---------------------------------------------------------------------
代码
----------------------
Private Sub Form_Load()
aaa: Text1.Text = "0"
If Option1.Value = 1 Then
If Mscomm1.PortOpen = False Then
Mscomm1.CommPort = 1
Mscomm1.Settings = "4800,e,8,1"
Mscomm1.PortOpen = True
Mscomm1.RThreshold = 5
Text1.Text = "1"
End If
Else
End If
If Option2.Value = 1 Then
If Mscomm1.PortOpen = False Then
Mscomm1.CommPort = 2
Mscomm1.Settings = "4800,e,8,1"
Mscomm1.PortOpen = True
Mscomm1.RThreshold = 5
Text1.Text = "2"
End If
Else
End If
If Option3.Value = 1 Then
If Mscomm1.PortOpen = False Then
Mscomm1.CommPort = 3
Mscomm1.Settings = "4800,e,8,1"
Mscomm1.PortOpen = True
Mscomm1.RThreshold = 5
Text1.Text = "3"
End If
Else
End If
End Sub
---------------------------------------------------------------------
说明:
程序运行时,串口设置不成功。
代码里面的Text1.Text =是为了调试方便而加入的。
请教大家:这代码错在哪里了?如何才能设置串口成功? |
阿莫论坛20周年了!感谢大家的支持与爱护!!
一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。
|