ALDL - My shot at it! [VB6]
I have a full carputer in a 1984 Pontiac Fiero Indy and have been working on an ALDL interface for a while now. There are 20 parameters sent on a 160 baud serial link for basic diagnostics. Recently I came across a spare ECU, so I rigged it for bench use and got down to it. I know lots of people have worked on this but THIS is the missing info I needed to figure this out, so I thought I'd share it collectively with this community that has help me greatly in this project.
The adapter I am using is the WinALDL compatible one you can build for pennies. If you don't know about WinALDL, google it read up on that first! Jonas has done great work on this and the only reason I'm not using his software is I wanted this integrated into my VB6 front end. His software is C++ and sadly my skills are nil on that - he even graciously gave me his source code to no avail. If all you want to do is read the ALDL data, use his stuff. If you want to integrate it into software, read on.
I've worked with this to some length and have come up with a sort of "breakthrough". Previously I had done testing using a USB-serial adapter, and I think that was throwing me off track as the data I was getting had no real pattern. But I'll get to that in a bit.
I do a fair bit with IP to serial adapters and decided to connect the WinALDL cable that way. Long story short, after comparing data streams pulled from the IP adapter to known good ones from WinALDL I started getting recognizable and comparable stream data. This is using a simple Winsock control and OnComm (in VB6). I configured the IP/Serial adapter to 2400/8/n/1, connected through ethernet to the computer and pulled bytes as they arrived.
Each byte would arrive as ASC value of 255 or 0. The 255s were converted to 1s, and each was treated as a BIT. There's the stream. Now it needs to be decoded. First you need to get 10 1's (1111111111) - that is the start string. Then, after that, you will get a 0 "start bit" (which you will discard) and 8 data bits. (Remember that each BYTE is actually a BIT as you are reading 160 baud over a 2400 baud connection). Every data byte will have the start bit plus 8 data bits. This will continue for how ever many data bits your ECU is sending (in my case 20), then you will get the 10 1's again.
Back to the USB/serial - after finding this stream with the IP adapter I went back to the USB and it seems to be missing bits. I will look into this further but my guess is the IP method handles errors or the buffer better and doesn't throw out bytes it doesn't like. It may also be VB6's COMM Control not handling the data correctly - this is more likely as the WinALDL software works flawlessly with the stream using the USB adapter. Still working on that.
Anyway, there it is. I don't really have any code to share as it is just rough test programs, but if I can clarify anything please let me know.