Skip to content

Instantly share code, notes, and snippets.

@agmangas
Last active November 24, 2024 21:26
Show Gist options
  • Select an option

  • Save agmangas/4f8ef5febcb7564274f77c49ccbc0ffb to your computer and use it in GitHub Desktop.

Select an option

Save agmangas/4f8ef5febcb7564274f77c49ccbc0ffb to your computer and use it in GitHub Desktop.

Revisions

  1. agmangas revised this gist Oct 15, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion can-id-png.md
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@ As the *PDU Format* is *greater or equal* than `F0` this is a **Global PGN**. In
    0000 0000 1111 0000 0000 0001
    ```

    > The PGN is a 24 bit value.
    > The PGN is a 18 bit value.
    Converted to decimal: `61441`.

  2. agmangas revised this gist Oct 15, 2018. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions can-id-png.md
    Original file line number Diff line number Diff line change
    @@ -42,15 +42,15 @@ Converted to decimal: `61441`.
    Original CAN ID:

    ```
    1 8 8 2 0 E 0 F
    0001 1000 1000 0010 0000 1110 0000 1111
    0 C 8 2 0 E 0 F
    0000 1100 1000 0010 0000 1110 0000 1111
    ```

    Separated on each individual part:

    Part | Value
    --- | ---
    Priority | `110`
    Priority | `011`
    Reserved | `0`
    Data Page | `0`
    PDU Format | `10000010`
  3. agmangas created this gist Oct 15, 2018.
    71 changes: 71 additions & 0 deletions can-id-png.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,71 @@
    # CAN IDs & J1939 PGNs

    ## Global PGN Example

    Original CAN ID:

    ```
    1 8 F 0 0 1 0 B
    0001 1000 1111 0000 0000 0001 0000 1011
    ```

    Separated on each individual part:

    Part | Value
    --- | ---
    Priority | `110`
    Reserved | `0`
    Data Page | `0`
    PDU Format | `11110000`
    PDU Specific | `00000001`
    Source Address | `00001011`

    > Notice that an **Extended CAN Identifier** has 29 bits, so the first three leading bits are not taken into account.
    As the *PDU Format* is *greater or equal* than `F0` this is a **Global PGN**. In this type of PGNs the *PDU Specific* is appended to the *PDU Format* to get the final PGN.

    ```
    000000 (6 bits) + Reserved (1 bit) + Data Page (1 bit) + PDU Format (8 bits) + PDU Specific (8 bits)
    ```

    ```
    0 0 F 0 0 1
    0000 0000 1111 0000 0000 0001
    ```

    > The PGN is a 24 bit value.
    Converted to decimal: `61441`.

    ## Specific PGN Example

    Original CAN ID:

    ```
    1 8 8 2 0 E 0 F
    0001 1000 1000 0010 0000 1110 0000 1111
    ```

    Separated on each individual part:

    Part | Value
    --- | ---
    Priority | `110`
    Reserved | `0`
    Data Page | `0`
    PDU Format | `10000010`
    PDU Specific | `00001110`
    Source Address | `00001111`

    As the *PDU Format* is *lower* than `F0` this is a **Specific PGN**. These belong to messages that are directed to a specific device (peer-to-peer).

    ```
    000000 (6 bits) + Reserved (1 bit) + Data Page (1 bit) + PDU Format (8 bits) + 00000000 (8 bits)
    ```

    ```
    0 0 8 2 0 0
    0000 0000 1000 0010 0000 0000
    ```

    Converted to decimal: `33280`.