Results 1 to 15 of 40

Thread: Looking for asistance with ALDL project...

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuel Injected!
    Join Date
    Mar 2013
    Posts
    1,477
    That dashboard is sick.
    The 2004 pcm is not likely to have built in aldl line. Hacking that is another topic.
    However it will stream rpm data over obd2. It uses VPW protocol.

    Why not just make a vpw -> aldl transciever.

  2. #2
    Fuel Injected! Quaraxkad's Avatar
    Join Date
    May 2019
    Posts
    37
    VPW, that's the Class 2 stream, right? I was looking into that as a possible source of input to get the RPM signal.

    But first, I think I may have a math problem in the code above... I attached a pot to use for input, and I get a whole sweep from 0 to 7000, but it happens in large chunks rather than one segment at a time. Almost like it's only reading the MSB.

    Code:
    int potPin = 2;
    int potVal = 0;
    
    void setup() {
      Serial.begin(8192);
    }
    
    void loop() {
      delay(100);
      if (Serial.availableForWrite() > 5) {
        potVal = analogRead(potPin) * 7;
        int rpm = potVal;
        byte msb = floor(rpm / 256);
        byte lsb = rpm % 256;
    
        byte b[5] = {0x0A, 0x58, 0x00, msb, lsb};
    
        unsigned int x = 0, sum = 0;
        for (x = 0; x < sizeof(b); x++) sum += b[x];
        byte cs = ( 256 - ( sum % 256 ) );
    
        Serial.write(b, 5);
        Serial.write(cs);
    
      }
    }
    I added the longer delay so I could see the onboard TX LED flashing, too short a delay and it just looks like it's *on*. The potentiometer input should be 0-1023, so multiplying that by 7 gives me something closer to my 0-7000 gauge. Am I calculating the lsb correctly?

  3. #3
    Fuel Injected!
    Join Date
    Mar 2013
    Posts
    1,477
    The whole conversion might be wrong

    Code:
     ldd     #$168
    RESERVED:90BF                 ldx     word_1C3 minorloop reference
    RESERVED:90C2                 fdiv
    RESERVED:90C3                 cpx     #$168
    RESERVED:90C6                 bhi     loc_90CB
    RESERVED:90C8                 ldx     #0
    RESERVED:90CB
    RESERVED:90CB loc_90CB:                               ; CODE XREF: BYTE_d1_SOME_SPEEDO_RELsub_8FEB+DBj
    RESERVED:90CB                 stx     word_1B26
    RESERVED:90CE                 xgdx
    RESERVED:90CF                 lsrd
    RESERVED:90D0                 lsrd
    RESERVED:90D1                 lsrd
    RESERVED:90D2                 adcb    #0
    RESERVED:90D4                 adca    #0
    RESERVED:90D6                 std     word_15D streamed word
    This is the pcm calculation from 94 pcm $0A 58 message. It is some kind of high res rpm, but time based than revolution based.

    To get a better picture of the dash conversion start dumping 0a 58 xx xx xx messages with raw mode in eehack program and look how it is interpreted by the dash.

    It could also be
    byte b[5] = {0x0A, 0x58, msb, lsb, 0x00};


  4. #4
    Fuel Injected! Quaraxkad's Avatar
    Join Date
    May 2019
    Posts
    37
    I tried manually setting numbers for all three values after 0x58 one at a time, and the second one is the only one that causes the gauge to respond. Even if my MSB and LSB calculation is correct, the LSB doesn't do anything! I can *not* imagine that's how the gauge works with only ~27 steps between 0 and 7000.

    I could play with eehack, but that's just another thing I don't understand and would have to learn how to wire up and use...

  5. #5
    Fuel Injected! Quaraxkad's Avatar
    Join Date
    May 2019
    Posts
    37
    Success! I changed my code to this and got a smooth sweep from 500 up...

    Code:
    byte msb = 0;
    byte lsb = 0;
    
    void setup() {
      Serial.begin(8192);
    }
    
    void loop() {
      delay(10);
      lsb++;
      if (lsb > 254) {
        msb++;
        lsb = 0;
      }
    
      byte b2[5] = {0x0A, 0x58, 0x00, msb, lsb};
    
      unsigned int x = 0, sum = 0;
      for (x = 0; x < sizeof(b2); x++) sum += b2[x];
      byte cs2 = ( 256 - ( sum % 256 ) );
      Serial.write(b2, 5);
      Serial.write(cs2);
    }
    Now to figure out what I was doing wrong to begin with. It's gotta be the LSB math?

  6. #6
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,055
    it worked already!?
    that byte order thing always screws me around too.
    the uno int is 16 bit so you can probably just cast it.

    b2[3] = (unsigned int)rpm;

  7. #7
    Fuel Injected! Quaraxkad's Avatar
    Join Date
    May 2019
    Posts
    37
    Something is weird here... I had the cluster out of the car because I was tired of walking back and forth to the garage for every tiny code change... That's when I got the smooth sweep. The gauge starts at 600, increases by one segment up to 3000, then two segments the rest of the way to 7000. I thought I was done with the precariously alligator-clipped bench setup, so I put it back in the car, may or may not have made changes to the code, can't remember... And now we're back to 5-7 segment chunks instead of 1-2. I'm finished fiddling for the day. Here's where I ended:

    Code:
    int rpm = 0;
    
    void setup() {
      Serial.begin(8192);
    }
    
    
    uint8_t get_cs(uint8_t *barray) {
      int x = 0;
      int sum = 0;
      int len = *(&barray + 1) - barray;
      for (x = 0; x < len; x++) sum += barray[x];
      return ( 256 - ( sum % 256 ) );
    }
    
    void loop() {
      if (Serial.availableForWrite() > 0) {
        delay(10);
        rpm++;
        uint8_t msb = (byte)((rpm >> 8) & 0xFFu);
        uint8_t lsb = (byte)(rpm & 0xFFu);
    
        //byte msg1[12] = {0x05, 0x5F, 0x00, 0x20, 0x00, 0x3C, 0x80, 0x00, 0x00, 0x02, 0x00, 0x01};
        //byte msg1_cs = get_cs(msg1);
    
        uint8_t msg2[5] = {0x0A, 0x58, 0x00, msb, lsb};
        uint8_t msg2_cs = get_cs(msg2);
    
        //byte msg3[4] = {0xF0, 0x56, 0xF4, 0xC6};
    
        Serial.write(msg2, 5);
        Serial.write(msg2_cs);
      }
    }

Similar Threads

  1. New guy old project
    By The Stickman in forum Introductions
    Replies: 1
    Last Post: 04-24-2015, 05:26 AM
  2. Need help on new project
    By SuperHbody in forum GM EFI Systems
    Replies: 0
    Last Post: 01-05-2015, 06:45 AM
  3. new here...odd project and need help
    By travisr1988 in forum GM EFI Systems
    Replies: 5
    Last Post: 04-19-2014, 06:30 PM
  4. Another TPI Project..
    By ezobens in forum GM EFI Systems
    Replies: 16
    Last Post: 01-20-2014, 05:49 PM
  5. 85 k5 project?
    By mjc in forum GM EFI Systems
    Replies: 0
    Last Post: 12-24-2013, 01:50 AM

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
  •