Hallo friends, please help me with short trouble:
When I push in my program button which read data from serial port, then when are here not data, it write this error which stop program:
The operation has timed out.
When I push in my program button to read data from serial port and when the data exists there, then is all OK...
Please what can I do for eliminating this message = when are not data in serial port, then I want become NO DATA and when exists data in serial port then I write this data....
Here is shorted program:
Private Sub program_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
Port1.PortName = "COM1"
Port1.BaudRate = 9600
Port1.DataBits = 8
Port1.StopBits = IO.Ports.StopBits.One
Port1.Parity = IO.Ports.Parity.None
Port1.Handshake = IO.Ports.Handshake.None
Port1.ReadTimeout = 50
Port1.DtrEnable = True
Port1.Open()
End Sub
Private Sub Timer_Renamed_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Timer_Renamed.Tick
Port1.Write(xconvert(8, 152)) ' delete for simulate NO DATA
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
readit = Port1.ReadByte()
If readit > -1 Then TextBox2.Text = TextBox2.Text & " " & readit
End Sub
Please, help me,
Hallo
olseh