当我按下刻度尺上的按钮时,这是我的代码:
Private Sub SerialPort1_DataReceived(sender As Object, e As SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
If comOpen Then
Try
readBuffer = SerialPort1.ReadExisting()
Me.Invoke(New EventHandler(AddressOf DoUpdate))
Catch ex As Exception
MsgBox("read " & ex.Message)
End Try
End If
End Sub
Public Sub DoUpdate(ByVal sender As Object, ByVal e As System.EventArgs)
TxtIn.AppendText(readBuffer)
End Sub
我的尺度为Metller Toledo AB204-S。
答案 0 :(得分:0)
最后我发现了我的卡住了
Private Sub BtnSend_Click(sender As Object, e As EventArgs) Handles BtnSend.Click
SerialPort1.WriteLine("SI" & vbCrLf)
End Sub
该代码命令SI和CrLf