Decode CAN DBC data
npm install can-dbc-decode
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
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
If have below input:
start: 60,
size: 4,
factor: 1,
offset: 0,
precision: 5,
endianness: 1
It will decode the data in red frame
String
, the input Hex data without 0x
, rawData should be no signed.
* required
Integer
, the start bit position.
* required
Integer
, the length of bits.
* required
Number
, factor of the returned data.
default: 1
Number
, offset of the returned data.
default: 0
Interger
, Max precesion of returned data.
default: undifined // no limitation
0 or 1
, 0 - Intel(little endian) and 1 - Motorola(big endian).
default: 0 - Intel(little endian)
MIT License
Copyright (c) 2019 intecessor