Hi to all:
I have this code, that retain the data from an serialport...My question is simple once i never had programming for serial ports and receiving data...
This code is correct? Or we can do something more to receive the data more fast, or in annother way!
Thanks
I have this code, that retain the data from an serialport...My question is simple once i never had programming for serial ports and receiving data...
This code is correct? Or we can do something more to receive the data more fast, or in annother way!
Code:
Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
receber_Tramas()
End Sub
Private Sub receber_Tramas()
trama_recebida = ""
Trama_A = ""
Trama_B = ""
Trama_c = ""
Dim str1 As String
Dim strarr() As String
str1 = SerialPort1.ReadLine
strarr = str1.Split(" ")
'Retrieve the number if the electronic board that is "0041"
Trama_B = Microsoft.VisualBasic.Left(str1, 4)
Select Case Trama_B
Case "0041"
'Manipule data from electronic board
trama_recebida = strarr(0)
trama_recebida = Microsoft.VisualBasic.Left(trama_recebida, 43)
Trama_A = Microsoft.VisualBasic.Mid(trama_recebida, 19, 4)
End Select
End Sub