|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2009-6-28 16:59:12
|
显示全部楼层
Private Sub Command20_Click()
Dim Temp As String
Dim buff_out7() As Byte
ReDim buff_out7(8)
Dim u As Long
MSComm1.Settings = "9600,N,8,1" ' 9600 波特,无奇偶校验,8 位数据,一个停止位。
MSComm1.InputLen = 0 ' 当输入占用时,告诉控件读入整个缓冲区。
buff_out7(0) = &HAA
buff_out7(1) = &HAA
buff_out7(2) = &HFF
buff_out7(3) = &H1
Open App.Path & "\2.txt" For Input As #2
Line Input #2, Temp
Close #2
u = Val(Temp)
If u > 0 And u < 65536 Then
buff_out7(5) = u Mod 256
buff_out7(4) = u \ 256
buff_out7(6) = &H0
buff_out7(7) = &H0
buff_out7(8) = &HFF
If MSComm1.PortOpen = False Then
Label1.Caption = "您的串口现在是关闭状态,请先打开串口"
Else
MSComm1.Output = buff_out7
Label1.Caption = ""
End If
End If
End Sub
针对这个用doevents 怎么解决啊 ?有的说用doevents 可以解决 |
|