The previous article describes the MSB and LSB, which describes more complex: signed and unsigned numbers.
1. Signal Symbols
The can signal has its physical significance, such as temperature, torque, etc., these signals are negative, there are 2 common solutions:
1) Set offset to negative value
If the temperature offset=-40, the temperature minimum-40.
2) can signal type is set to signed
As mentioned in the previous article, the signal definition has signedflag, when Signedflag is the minus sign, the signal is represented by the symbol.
- Format: Sg_ Name : StartBit | Length @ byteorder signedflag (Factor,Offset) [Minimum | Maximum] "Unit" Receiver1,Receiver2
2. signal Transmission
The comparison length is a byte (8 bit) data transfer.
1) Unsigned number
Value range: 0~255 (2^8-1), transfer the original code. For example: 7=00000111.
2) signed number
The highest bit is the sign bit, the value range: -128~127, positive transmission of the original code, negative transmission complement. For example-7, the original code = 10000111, complement (except the sign bit counter, plus 1) = 11111001. The network transmits is the complement.
3. Signal Parsing
Based on the previous article, the Dbcvalue project was updated to compare the values of unsigned data. Reply to "dbc example" to get.
1) Unsigned number
2) signed number
The story of DBC (ii)