haha yeah, its just frustrating when things "should" work, but dont because of a silly mistake!
The serialport settings im current using are:
Code: Select all
SerialPort1.BaudRate = ComboBoxBaudRate.SelectedItem
SerialPort1.PortName = ComboBoxCom.SelectedItem
SerialPort1.DataBits = 8
SerialPort1.Handshake = IO.Ports.Handshake.None
SerialPort1.NewLine = vbCr
SerialPort1.Parity = IO.Ports.Parity.None
SerialPort1.StopBits = IO.Ports.StopBits.One
SerialPort1.ReadTimeout = 1000
which Im fairly certain are the settings I want since they were working.
And the elm327 code reader im using is:
Code: Select all
Public Function DetectElmDeviceGetResponse(SentFrame As String)
Dim ReceivedFrame As String = ""
Dim Counts2Exit As Integer = 0
Do 'do until exited
Try
'if there is something there.. read it!
ReceivedFrame = SerialPort1.ReadLine 'Read Message!
If ReceivedFrame <> SentFrame Then 'check if received frame matches sent.. ignore if so
If ReceivedFrame.Contains("SEARCHING...") Then 'ignore.. move onto next
'ignore this
ElseIf ReceivedFrame.Contains("NO DATA") Then 'ELm says no response.. fail! Shouldnt happen since gtting Elm info!
Return "Failed"
Else
Return ReceivedFrame 'hopefully out response
End If
End If
Catch ex As TimeoutException 'if nothings available, timout after 1 second.
Counts2Exit += 1
If Counts2Exit = 5 Then 'fail after timeout 4times
SetRichTextBox_ThreadSafe("Timed Out!", RichTextBoxReceive)
Return "Failed"
Else
SetRichTextBox_ThreadSafe("Timed out.. Searching again.." & Counts2Exit, RichTextBoxReceive)
End If
End Try
Loop
End Function
Attached is another version, added another connection button on the right, try setting the comport/baud and click the "connect" on the right. That one will display everything that shows up over serialport, will display byte by byte.. so if the elm actually responds.. it will definitely show up there.. else theres something wrong! The elm will display "?" if it doesnt understand the command of the command is unfinished.
Unfortunately couldn't change the framework requirements.