G
Guest
Hey all-
I am pretty new to serial communication, but from what I am experiencing it
is a little slow in VB.net (2.0). Using other tools I can communicate with
my hardware extreamly fast without any problems. With VB, I have to insert a
Sleep(200) to receive all of the data back from my orignal request. Any way
to speed this up a bit? The return message is very small.
Dim myport As SerialPort = New SerialPort
myport.PortName = "COM1"
myport.BaudRate = "115200"
myport.StopBits = IO.Ports.StopBits.One
myport.DataBits = 8
myport.Parity = IO.Ports.Parity.None
myport.Open()
myport.Write(buffer, 0, buffer.Length)
Dim Outputbuffer(15) As Byte
Dim mystring As String
Dim i As Integer
Sleep(200) ' Sleep for 1 second
myport.Read(Outputbuffer, 0, Outputbuffer.Length)
For i = 0 To Outputbuffer.Length - 1
mystring = mystring & " " & Hex(Outputbuffer(i))
Next
myport.Close()
txtOutput.Text = mystring
I am pretty new to serial communication, but from what I am experiencing it
is a little slow in VB.net (2.0). Using other tools I can communicate with
my hardware extreamly fast without any problems. With VB, I have to insert a
Sleep(200) to receive all of the data back from my orignal request. Any way
to speed this up a bit? The return message is very small.
Dim myport As SerialPort = New SerialPort
myport.PortName = "COM1"
myport.BaudRate = "115200"
myport.StopBits = IO.Ports.StopBits.One
myport.DataBits = 8
myport.Parity = IO.Ports.Parity.None
myport.Open()
myport.Write(buffer, 0, buffer.Length)
Dim Outputbuffer(15) As Byte
Dim mystring As String
Dim i As Integer
Sleep(200) ' Sleep for 1 second
myport.Read(Outputbuffer, 0, Outputbuffer.Length)
For i = 0 To Outputbuffer.Length - 1
mystring = mystring & " " & Hex(Outputbuffer(i))
Next
myport.Close()
txtOutput.Text = mystring