Hi All,
I am sending commands to an instrument via a serial port and getting back the data however
when I run the code the commands are sent and the reply is got (to a rich text box). How ever as the serial port is piped to the rtb via an invoke command not all the details are there every time if I run it through the debugger the commands work, the data is got, however if I run the .exe from the desktop not all the data is there and it falls over. I think it might be due to the system running quicker with out the debugger attachment. I need a way of slowing the threads not using a thread sleep (which takes the thread out!), I have tried using a Thread Sleep which works all the time in the debugger and only some times in the exe.
Sorry got lost in something else clicked post before reading properly
Data_Read = rtbIncoming.Text
MsgBox("Data :" + Data_Read)
The actual routine that does the reading is here:
Private Sub port_DataReceived_1(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs)
NoDataAtPort.Enabled = False
InputData = myComPort.ReadExisting
Reply_Status = REPLY.YES_REPLY
If InputData <> [String].Empty Then
Me.Invoke(New SetTextCallback(AddressOf SetText), New Object() {InputData})
DataReceived = True
Else
MsgBox("null")
End If
TmrNoDataAtPort.Enabled = False
If (Reply_Status = REPLY.TIMEOUT_REPLY) Then
Data_Back = "TIMEOUT"
ElseIf (Reply_Status = REPLY.YES_REPLY) Then
NoDataAtPort.Enabled = False
End If
If (DataReceived = True) Then Me.Invoke(New PutInRightTextBox(AddressOf DecphierCommand), New Object() {InputData})
End Sub
DecphierCommand() is just a case statement to split the rtbIncoming data up.
Sorry about that got caught with something had to do it...
Glenn