Private Sub Timer3_Timer()
If MSComm1.PortOpen = True Then
Dim outstring As String
Dim instring As String
Dim d As Long
Dim e As String
Dim f As String
MSComm1.OutBufferCount = 0
MSComm1.InBufferCount = 0
outstring = Chr(&H2) + "0" + "119002" + Chr(&H3) + "60" '讀D200數據
MSComm1.Output = outstring
Do
DoEvents
Loop Until MSComm1.InBufferCount = 8
MSComm1.InputMode = comInputModeText
MSComm1.InputLen = 0
instring = MSComm1.Input
e = instring
f = Mid(instring, 2, 4)
d = CLng("&H" & f)
Text5.Text = (d And &HFF00) \ &H100 + (d And &HFF) * &H100
End If
If Text5.Text = "1" Then
Label2.Caption = "非常停止中"
End If
If Text5.Text = "2" Then
Label2.Caption = "暫停中"
End If
End Sub