Results 1 to 8 of 8

Thread: State PID Question

  1. #1
    Guess who's back!!!! Black02SS's Avatar
    Join Date
    Jan 2004
    Posts
    1,355

    Default State PID Question

    I have tried to read but I can't find this information. How would I create a calculated PID from STATE02:

    Description Status=0 Status=1
    Unused - -
    Extended Travel Brake Pedal Switch Released Applied
    Unused - -
    Reverse Inhibit No Yes
    Cruise Brake Pedal Switch Released Applied
    Clutch Pedal Switch Released Applied
    VAT Fuel Disable Inactive Active
    Traction Control Status Inactive Active

    I see that a value of 0 is Released and 1 is Applied. I am trying to make it so I can see the values on the chart display and in a map.

    Thanks

  2. #2
    Joe (Moderator) joecar's Avatar
    Join Date
    Apr 2003
    Posts
    28,403

    Default

    Edit: the red one above was thought to be bit 5, but it turns out to be bit 2.


    The red one is bit 2 (bits are numbered starting from 0, starting from the bottom).

    2^2 = 4

    So you could use either of these in your calc pid:

    iff({GM.STATE02} & 4, 1, 0)
    {GM.STATE02} / 4 & 1
    {GM.STATE02} >> 2 & 1

    The first one says: if the bit with value 4 is on, return 1, else return 0.

    The second one says: divide by 4 (i.e. shift right 2 bits), and then keep the lowest bit (throw away other bits).

    The third one says: shift right 2 bits and then keep the lowest bit.

    Edit: Paul says below that the raw value of the pid is required before it is operated on, so the above become:

    iff(raw({GM.STATE02}) & 4, 1, 0)
    raw({GM.STATE02}) / 4 & 1
    raw({GM.STATE02}) >> 2 & 1
    Last edited by joecar; March 11th, 2021 at 09:19 AM. Reason: Added example using >>

  3. #3
    Guess who's back!!!! Black02SS's Avatar
    Join Date
    Jan 2004
    Posts
    1,355

    Default

    I have tried this here and still can't get it to show the right values. Anymore ideas? What are you using for the "units" in the pid file? I am trying to understand where you got 32 from in this equation and Paul got 128 for the other DFCO one.

  4. #4
    Guess who's back!!!! Black02SS's Avatar
    Join Date
    Jan 2004
    Posts
    1,355

    Default

    Ok I did some more testing on this and I can't get it to work at all. I keep returning a constant value. Anymore ideas on this?

  5. #5
    EFILive Developer Site Admin Blacky's Avatar
    Join Date
    Mar 2003
    Posts
    9,503

    Default

    There may be a problem working with bitfields in calculated PIDs. It is still being tracked down.
    Paul
    Before asking for help, please read this.

  6. #6
    EFILive Developer Site Admin Blacky's Avatar
    Join Date
    Mar 2003
    Posts
    9,503

    Default

    Quote Originally Posted by joecar
    The red one is bit 5 (bits are numbered starting from 0).

    2^5 = 32

    So you could use either of these in your calc pid:

    iff({GM.STATE02} & 32,1,0)
    {GM.STATE02} / 32 & 1

    The first one says: if the bit with value 32 is on, return 1, else return 0.

    The second one says: divide by 32 (i.e. shift right 5 bits), and then keep the lowest bit.
    Ok, the problem is that you need the "raw" value of the STATE PIDs before you can apply bit-logic, like this:

    iff(RAW({GM.STATE02})&32,1,0)
    RAW({GM.STATE02}) / 32 & 1

    The values (32 and 128) are used so that they match the value of a bit positionin the PID's value. 32 is bit 5, 128 is bit 7.

    Bit position 7 = 128
    Bit position 6 = 64
    Bit position 5 = 32
    Bit position 4 = 16
    Bit position 3 = 8
    Bit position 2 = 4
    Bit position 1 = 2
    Bit position 0 = 1

    The above order is the order that the bit values are listed when you select "More info..." to display the STATE value bit flags.

    Regards
    Paul
    Before asking for help, please read this.

  7. #7
    Guess who's back!!!! Black02SS's Avatar
    Join Date
    Jan 2004
    Posts
    1,355

    Default

    Quote Originally Posted by Blacky
    Ok, the problem is that you need the "raw" value of the STATE PIDs before you can apply bit-logic, like this:

    iff(RAW({GM.STATE02})&32,1,0)
    RAW({GM.STATE02}) / 32 & 1

    The values (32 and 128) are used so that they match the value of a bit positionin the PID's value. 32 is bit 5, 128 is bit 7.

    Bit position 7 = 128
    Bit position 6 = 64
    Bit position 5 = 32
    Bit position 4 = 16
    Bit position 3 = 8
    Bit position 2 = 4
    Bit position 1 = 2
    Bit position 0 = 1

    The above order is the order that the bit values are listed when you select "More info..." to display the STATE value bit flags.

    Regards
    Paul
    Thanks. Here is something. I used your pid and it didn't work, but I started thinking about the values you have and the More info in the pid. I calculated down and it said that Clutch Pedal Switch Release was at BIT position 2, so I used 4 and BINGO, it works. Did I do something wrong? Thanks Paul!

  8. #8
    Joe (Moderator) joecar's Avatar
    Join Date
    Apr 2003
    Posts
    28,403

    Default

    Chad,

    Sorry, I had the order of the bits reversed (I counted from the top instead of from the bottom)...

    see my edit to post #2.
    Last edited by joecar; June 19th, 2010 at 06:59 AM.

Similar Threads

  1. ECM in unknown state :(
    By SmokinDuradog in forum General (Diesel)
    Replies: 11
    Last Post: September 2nd, 2009, 02:48 AM
  2. ETC LQ9 State 16 APP what criteria?
    By 4wheelin in forum Gen III V8 Specific
    Replies: 0
    Last Post: February 18th, 2009, 07:29 PM
  3. TCM in unknown state
    By Sparky8370 in forum General (Diesel)
    Replies: 6
    Last Post: July 2nd, 2008, 09:28 AM
  4. Ecm in unknown state
    By HotRodSS in forum Duramax LB7
    Replies: 7
    Last Post: July 1st, 2008, 09:34 PM

Posting Permissions

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