Announcement

Collapse
No announcement yet.

Pid HELP

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pid HELP

    I am writing a program for a class and I need to know the correct way to send a PID in to get information back from the ecu.

    the line of code i am using is
    sport1.write("PID")

    sport1 is defined as a serial port

    I can access the OBD to USB scanner in realterm and get the hex variables but when i open the port in my VB program I don't get anything plus the scanner doesnt say its connected like it does in realterm.

    any help would be greatly appreciated

  • #2
    Three answers:

    1) The short version is, sport1.write("0105") where "05" is the PID. Then parse the response.

    2) The long, correct, version is,
    Read the document written by the people that basically invented consumer-level OBDII stuff, wherein it's all explained in semi-adequate detail: http://elmelectronics.com/DSheets/ELM327DS.pdf.
    That doesn't explain how to actually interpret the values, IIRC, for that you need to head on over to everyone's favorite easy reference website.

    3) The cheating-on-your-homework way is http://svn.icculus.org/obdgpslogger/trunk/ read someone else's code. Basically, it never pans out to be *quite* as simple as "write a number, read a number". I've been working on this code for months, and it's still not perfect.

    Gary (-;
    OBDGPSLogger, for logging OBDII and/or GPS data
    OBDSim, an OBDII/ELM327 software simulator
    mp3car forums: obdgpslogger, obdsim

    Comment


    • #3
      Thanks for the info, the funny thing is I've got the wikipedia site and the elm document saved. I'm still having a problem getting a reply from the OBD.

      I'm using
      sport1.readexisting()=textbox.text but it is not displaying anything.

      Comment


      • #4
        I would suggest that your first step should be to download PuTTY, and do this stuff by hand, before trying to do it programmatically.

        Gary (-;
        OBDGPSLogger, for logging OBDII and/or GPS data
        OBDSim, an OBDII/ELM327 software simulator
        mp3car forums: obdgpslogger, obdsim

        Comment


        • #5
          i use realterm which can open a terminal for a selected com port.

          Comment


          • #6
            Uhhuh? So you start that, and type "ATZ" and hit enter, what happens?

            Then you type "0100", and what happens?

            Gary (-;
            OBDGPSLogger, for logging OBDII and/or GPS data
            OBDSim, an OBDII/ELM327 software simulator
            mp3car forums: obdgpslogger, obdsim

            Comment


            • #7
              atz displays ELM scan v. something
              the other one says no data i think i was trying the RPM pid 010C.
              I can get the hex here but can't display it on my program.

              Comment


              • #8
                0100 is the first interesting one that you need to read - that's a bit pattern of the PIDs that are supported up to 0x40.

                What's the hex returned for rpm? [that's what you asked for]

                I'm guessing it's something like 41 0C AA BB ?

                41 => 0x40 [success] + 0x01 [mode you requested]
                0C => PID requested
                AA BB => two bytes representing RPM, measured in 1/4ths of a RPM

                Gary (-;
                Gary (-;
                OBDGPSLogger, for logging OBDII and/or GPS data
                OBDSim, an OBDII/ELM327 software simulator
                mp3car forums: obdgpslogger, obdsim

                Comment


                • #9
                  The 010C returned a value of 909 after it was ran through the formula which was idle so it was right.

                  I downloaded a com port monitor and found out why I don't get a return value in my program. The data I am writing to the port is just sitting there, there is no hard return to let the port know that it was a command. Pretty f'ed up now I need to find a way to get the port to hard return so there is a value ther.

                  Comment


                  • #10
                    \r

                    LOL

                    Comment


                    • #11
                      is that the same as Chr(13) cuz this one kinda works, now i need to find out how to retrieve the data when i use the sport1.readexisting() and sport1.readline() it times out. Any thoughts.

                      Thanks for all your help.

                      Comment


                      • #12
                        Yes, char 13 is the same as control-R.

                        Comment


                        • #13
                          Now i cant get the com port to send the response for the submitted command, its always a response to the previous command.

                          Comment


                          • #14
                            It sounds like you're not waiting for the response.

                            Comment


                            • #15
                              well how would i correct that

                              Comment

                              Working...
                              X