pylab_ml.common.data.j1850_crc

j1850_crc(buffer, length=None)[source]

J1850 CRC-Calculation.

eg. j1850_crc([0x01, 0x02, 0x03, 0x04]) -> 0x1D

j1850_crc([0xAB, 0xCD, 0xEF]) -> 0x4B j1850_crc([0x00, 0xFF, 0x55]) -> 0xA2

Parameters:
  • buffer (list of int) – Input data for which the J1850 CRC is to be calculated. The data should be a list of integers representing bytes (0-255).

  • length (int, optional) – Number of bytes to consider from the buffer for CRC calculation. If None, the entire buffer will be used. Default is None.

Returns:

The calculated J1850 CRC value as an integer.

Return type:

int