发表于:2006-09-07 11:47:00
16楼
是这样
由于有很多个点要扫描
我是每一个开始扫描的时候都先对缓冲清零了
1秒也试过
还是这样
不然把程序拿上来看一下,很简单的
Private Sub Timer1_Timer()
Dim pc_read11 As String
Dim timwr11 As Single
Dim A As String
Dim B As String
Dim C As String
[color=#FF0000]Timer1.Enabled=0[/color]
MSComm1.InBufferCount = 0
MSComm1.OutBufferCount = 0
MSComm1.Output = Chr(5) + "00FFWR0D0120022E"
timwr11 = Timer
Do
If Timer > timwr11 + 0.1 Then: GoTo err_check11
Loop Until MSComm1.InBufferCount = 16
pc_read11 = MSComm1.Input
If Mid(pc_read11, 1, 5) = Chr(2) + "00FF" Then
A = Mid(pc_read11, 8, 2)
B = "&h" + A
C = Val(B)
Text5.Text = C
Else
MsgBox "传输错误!"
End If
err_check11:
pc_read11 = MSComm1.Input
然后还有若干个类似的通讯命令
在每个开始的时候都有
MSComm1.InBufferCount = 0
MSComm1.OutBufferCount = 0
来清零呀
[color=#FF0000]Timer1.Enabled=1[/color]