8000 GitHub - weiniuzhu/can-dbc-decode: Decode CAN DBC data
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

weiniuzhu/can-dbc-decode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

can-dbc-decode

Decode CAN DBC data

Install

npm install can-dbc-decode

Usage

const decode = require('can-dbc-decode')

const input = {
  rawData: '46220000FFFFFFFF',
  start: 0,
  size: 32,
  factor: 0.05,
  offset: 0,
  precision: 5,
  endianness: 0
}

decode(input)

// => 438.7

Concept

Assuming the rawData in HEX is 0x0000047900000033, grouped HEX data is 00 00 04 79 00 00 00 33
In Motorola(big endian) format, The bit map of this rawData is

bitMap


If have below input:

  start: 60,
  size: 4,
  factor: 1,
  offset: 0,
  precision: 5,
  endianness: 1

It will decode the data in red frame

bitMap


Input params

rawData

String, the input Hex data without 0x, rawData should be no signed.
* required

start

Integer, the start bit position.
* required

size

Integer, the length of bits.
* required

factor

Number, factor of the returned data.
default: 1

offset

Number, offset of the returned data.
default: 0

precision

Interger, Max precesion of returned data.
default: undifined // no limitation

endianness

0 or 1, 0 - Intel(little endian) and 1 - Motorola(big endian).
default: 0 - Intel(little endian)

License

MIT License

Copyright (c) 2019 intecessor

About

Decode CAN DBC data

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0