I am building an app that communicates to an Elm327 divice on my com port,
I need to know how to do thiss, I have made a smaller app for testing, I can connect to device, I know this as the device then sends me a message, now I need to know how to send the command
"AT DP" and receive its response?
please help.

9 Years
Discussion Span
Last Post by networx

Ok I have tried

Private Sub Command3_Click()
MSComm1.Output = "at dp"
End Sub
Private Sub Command3_Click()
MSComm1.Output = "at dp"
End Sub
Private Sub Command3_Click()
SendBytes "AT DP"

End Sub
Public Sub SendBytes(ByteString)
Dim ByteArray As Variant
ByteArray = Split(ByteString, " ")
For i = 0 To UBound(ByteArray)
    MSComm1.Output = Chr(CInt("&h" & ByteArray(i)))
End Sub

Nothing results in a reply from the device?
Can anyone help me?


Finally figured out how to send, I was missing vbCR for carrage return I take it.

MSComm1.Output = "at dp" &vbCr

The next issue I have is, When I click my connect button, I need to send 2 commands right away, but now I only get the response from the first command, obviuosly I need to put a pause in between the 2 command fires, but have not worked with timers, could some one tell me how to configure a timer between two commands? or even better how to pause the second command until we receive a reponse from device for first command?


I am close to getting a pause timer but the ore I think about it, later on this will be useless as I will be firing many commands and want it to be fast and not pausing, so a way of waiting for a reply before firing next command would be better, something like

If (MSComm1.CommEvent = comEvReceive) Then
Else Loop

I have tried many variations, this one doesnt throw and error but still doesn't work

If (MSComm1.CommEvent = comEvSend) Then
MSComm1.Output = "AT DP" & vbCr
End If

Any suggestions?


I'm trying for this too, with hyperterminal everything is going fine and phone sending response but when i send data with mscomm to the phone it doesn't send response :(((

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.