Extract J1939 EEC1 engine speed and copy the C99 helper
The example represents the Electronic Engine Controller 1 payload, PGN 61444, with SPN 190 engine speed. It shows a synthetic classic 8-byte frame with the engine speed in one-based bytes 4 and 5. Enter payload bytes only, then use the PGN and SPN definition to choose the field layout.
Open Generated C99 masks and functions and choose Copy C code. The generated function reads the selected payload bits and can apply the configured scaling. Production code should validate the frame ID, payload length and the SPN’s special values before accepting a physical reading.
Formulas
Raw SPN 190 = payload[3] | (payload[4] << 8)
Engine speed in rpm = raw × 0.125
Unsigned field mask = 2^bit length − 1
Worked example
The speed bytes 80 3E combine in little-endian order to give 0x3E80, or 16,000. Multiplying by 0.125 gives 2,000 rpm. The 16-bit C99 mask is 0xFFFF.
What DBC start bit corresponds to J1939 EEC1 bytes 4 and 5?
Use zero-based start bit 24, length 16 and Intel byte order for SPN 190 with its least significant byte in one-based byte 4.
Does it accept the 29-bit CAN identifier with the payload?
Enter the eight data bytes in the payload box. Use the 29-bit identifier upstream to identify the PGN and select the matching signal definitions.
How should I handle a raw unavailable or error value?
Read the valid and reserved ranges from the SPN definition and handle reserved codes before using the scaled result. The generic bit extractor reports the value implied by the configured scaling.