Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: OBD2 Source code for opto interface

  1. #1
    Low Bitrate
    Join Date
    Aug 2004
    Posts
    78

    OBD2 Source code for opto interface

    Can anyone help me to OBD2 source code for a optocoupler interface, i can only find source code for the elm interface and i dont have one. My car is a Seat Leon TDI (VW TDI is the same) and i want to make a virtual dashboard but i dont have a clue of where to start (never did RS232 Programming and dont know how to initialize / talk to the ECU)

  2. #2
    Low Bitrate
    Join Date
    Aug 2004
    Posts
    78
    Quote Originally Posted by Maddog_rvo
    Can anyone help me to OBD2 source code for a optocoupler interface, i can only find source code for the elm interface and i dont have one. My car is a Seat Leon TDI (VW TDI is the same) and i want to make a virtual dashboard but i dont have a clue of where to start (never did RS232 Programming and dont know how to initialize / talk to the ECU)
    I can program in c#, found something to get me going for a small bit. I need to send the ECU 0x33 (in what format?) at 5 baud to initiate communication.

    How can i send 0x33 to the ECU? I can program the comport but dont know what to send

    is it like com.Output("0x33");
    or com.Output(51);

    Can anyone please help me (if u could provide some more information, like how to ask RPM or something PLEASE )

    This is drivin me

  3. #3
    Low Bitrate
    Join Date
    Aug 2004
    Posts
    78
    I tried the elm interface from a friend of mine, downloaded 3 different logging programs and they are WAY to slow for what i want (updated like once in a second) I want graphic dials that show Boost, Speed and RPM (maybe some more) but with elm i drove 100km/h and it still said 80km/h while if i use VAG-COM with my opto coupler interface it updates almost instantly so i really need help with designing software for interrogating my PC

  4. #4
    Low Bitrate
    Join Date
    Aug 2004
    Posts
    78
    Anyone please?

  5. #5
    Newbie
    Join Date
    Sep 2005
    Posts
    38
    Well, I program c# for a living. I have done a lot of interactions with machines through TCP and UDP. Now 0x33 is just a hex number that would fill one byte. I Imagine you would be sending a command set that is a certain number of bytes, this might just be one.

    byte [] tmp = new byte[1];
    tmp[0] = 0x33;

    All you would have to do is send off that byte. I haven't done much with RS232 but it can't be far off. I would have to look at the RS232 libraries which i think are available with .net 2.0 which is still being developed. How are you connecting to the RS232 port? What is the data structure the libraries want you to send across the device?

    I imagine you are going to have to work with bytes because the ELM device from what I understand converts to ASCII and thats probably where the delay comes in. If you use a non ELM device, the only way would be to convert the Hex that comes in, which is probably stored in bytes.

  6. #6
    Newbie
    Join Date
    Sep 2005
    Posts
    38
    here is a c++ function I found that is suppose to handle the init for 5 baud:

    char diag_l0_initbus(void)
    {

    TRISC6 = 0; //Set RC6 as output
    //Now we need to sent address of 0x01 at 5 baud

    OBD_K_LINE = 0;

    DelayMs(200);

    OBD_K_LINE = 1;

    DelayMs(200);

    OBD_K_LINE = 0;

    DelayMs(200); //A high of 1400mS
    DelayMs(200);
    DelayMs(200);
    DelayMs(200);
    DelayMs(200);
    DelayMs(200);
    DelayMs(200);

    OBD_K_LINE = 1;

    //Now config serial port
    SPBRG=29; // data rate for sending/receiving @ 10400 baud
    BRGH=0; // data rate for sending/receiving
    SYNC=0; // asynchronous
    SPEN=1; // enable serial port pins
    CREN=1; // enable reception
    SREN=0; // no effect
    TXIE=0; // disable tx interrupts
    RCIE=0; // disable rx interrupts
    TX9=0; // 8-bit transmission
    RX9=0; // 8-bit reception
    TXEN=1; // enable the transmitter

    }

    from http://www.skpang.co.uk/ecu_reader.htm

  7. #7
    Low Bitrate
    Join Date
    Aug 2004
    Posts
    78
    Quote Originally Posted by jjakes24
    Well, I program c# for a living. I have done a lot of interactions with machines through TCP and UDP. Now 0x33 is just a hex number that would fill one byte. I Imagine you would be sending a command set that is a certain number of bytes, this might just be one.

    byte [] tmp = new byte[1];
    tmp[0] = 0x33;

    All you would have to do is send off that byte. I haven't done much with RS232 but it can't be far off. I would have to look at the RS232 libraries which i think are available with .net 2.0 which is still being developed. How are you connecting to the RS232 port? What is the data structure the libraries want you to send across the device?

    I imagine you are going to have to work with bytes because the ELM device from what I understand converts to ASCII and thats probably where the delay comes in. If you use a non ELM device, the only way would be to convert the Hex that comes in, which is probably stored in bytes.
    Thanks, i`ll look into that, try to get that code to work

    I`m going to send bytes into the optocoupler interface which sends it unmodified to ECU (Well i`m trying to do that ) The datastructure that the libraries want is either a string or a byte. The library is use is one i found on internet (found a VB source code called RS232 and made a DLL out of that which i use for C#)

    The bit of code i have now is found on : http://members.home.nl/hjmoers
    Warning : I`m not a good programmer and i dont even know if this code is going to work. I`m still learning programming and i do have help from a friend but he wont help with this yet, he says i gotta do it myself

  8. #8
    Newbie
    Join Date
    Sep 2005
    Posts
    38
    the code looks ok to me as long as that RS232 class does what it is suppose to do. I haven't built my device yet so I haven't been able to play around with things but it should take me no longer than a day to get my stuff going. I'll let you know where I stand in about 3 weeks. Let me know of your progress if the code worked for you or not.

  9. #9
    Low Bitrate
    Join Date
    Aug 2004
    Posts
    78
    Quote Originally Posted by jjakes24
    the code looks ok to me as long as that RS232 class does what it is suppose to do. I haven't built my device yet so I haven't been able to play around with things but it should take me no longer than a day to get my stuff going. I'll let you know where I stand in about 3 weeks. Let me know of your progress if the code worked for you or not.
    Well i dont think the RS232 class does what it is supposed to do, i get no errors or whatsoever but it does totally nothing. I`m going to try and find another RS232 class

  10. #10
    Low Bitrate
    Join Date
    Aug 2004
    Posts
    78
    Quote Originally Posted by jjakes24
    the code looks ok to me as long as that RS232 class does what it is suppose to do. I haven't built my device yet so I haven't been able to play around with things but it should take me no longer than a day to get my stuff going. I'll let you know where I stand in about 3 weeks. Let me know of your progress if the code worked for you or not.
    I`ll post some new code, got it working for now, the code sends some bytes to the ECU but the only thing i receive are the exact same codes and sometimes the program crashes and says frame error


    A nice link with good info (in german )
    http://www.blafusel.de/misc/obd2_kw1281.html#5
    Another one in english :
    http://www.hex.co.za/vaginfo/index.html

    I think i cant get the 5 Baud rate to work properly so the ECU wakeup wont work and thats probably the reason why i dont get a response

Page 1 of 2 12 LastLast

Similar Threads

  1. GPS/MapPoint VB Source Code
    By stevieg in forum Software & Software Development
    Replies: 7
    Last Post: 01-28-2011, 04:59 PM
  2. My VB code for Elm interface! OBD2
    By infinkc in forum Engine Management, OBD-II, Engine Diagnostics, etc.
    Replies: 14
    Last Post: 01-29-2009, 11:22 AM
  3. Alpha Release: XMPC-CAR for XM
    By gork in forum Software & Software Development
    Replies: 88
    Last Post: 01-11-2006, 01:19 PM
  4. GPS:MM shutdown RR when switch skin
    By MatrixPC in forum RR Bug Tracker
    Replies: 5
    Last Post: 05-12-2005, 12:07 PM
  5. master volume doesnīt work
    By free2world8000 in forum RR Bug Tracker
    Replies: 14
    Last Post: 02-17-2005, 01:08 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •