... | ... | @@ -146,6 +146,30 @@ Observations: |
|
|
## Signed and Unsigned Signals
|
|
|
A signed signal can be sent by simply applying a negative offset to a signal. Let's add a signed signal to the previous message.
|
|
|
|
|
|
Observations
|
|
|
* ```@1-```: Defines that ```IO_DEBUG_test_signed``` signal is little-endian, and signed.
|
|
|
|
|
|
## Fractional Signals
|
|
|
A floating point variable can be sent by deciding the range, and the precision that you require. For example, if we choose 8-bits, with ```0.1``` as a fraction, we can send the data range of ```0.0 -> 25.5```. On the other hand, if we want more precision and negative representation, we could use 12-bits with ```0.01``` as a fraction, and an offset. The second fractional signal also contains an explicit minimum and maximum, which is limited by 12-bit that can represent 4096 different numbers, and by factoring in the offset, and using half of the range for negative representation, it ends up with the limited range of ```-20.48 -> 20.47```.
|
|
|
|
|
|
```
|
|
|
BO_ 500 IO_DEBUG: 4 IO
|
|
|
SG_ IO_DEBUG_test_unsigned : 0|8@1+ (1,0) [0|0] "" DBG
|
|
|
SG_ IO_DEBUG_test_signed : 8|8@1- (1,-128) [0|0] "" DBG
|
|
|
SG_ IO_DEBUG_test_float1 : 16|8@1+ (0.1,0) [0|0] "" DBG
|
|
|
SG_ IO_DEBUG_test_float2 : 24|12@1+ (0.01,-20.48) [-20.48|20.47] "" DBG
|
|
|
```
|
|
|
|
|
|
Observations
|
|
|
* Fractional signal is calculated as: [calculated value] = [offset] + [scale] * [raw value]
|
|
|
* IO_DEBUG_test_float1: variable is calculated as ``` 0 + 0.1 * [raw value] ```.
|
|
|
* IO_DEBUG_test_float2: variable is calculated as ``` -20.48 + 0.01 * [raw value] ```.
|
|
|
|
|
|
## Little Endian Examples
|
|
|
|
|
|
Signals that are defined as Little Endian in the DBC are easier to edit manually without a UI based DBC editor. This is because when we indicate that an LSB of a signal is "4" and is a 14-bit signal, then it is easier to understand the bounds of this signals are `b17 ... b4`.
|
|
|
|
|
|
|
|
|
**Example 1**
|
|
|
```
|
|
|
BO_ 500 IO_DEBUG: 4 IO
|
... | ... | @@ -203,29 +227,6 @@ BO_ 200 SENSOR_SONARS: 4 SENSOR |
|
|
+-- SENSOR_SONARS_middle
|
|
|
```
|
|
|
|
|
|
Observations
|
|
|
* ```@1-```: Defines that ```IO_DEBUG_test_signed``` signal is little-endian, and signed.
|
|
|
|
|
|
## Fractional Signals
|
|
|
A floating point variable can be sent by deciding the range, and the precision that you require. For example, if we choose 8-bits, with ```0.1``` as a fraction, we can send the data range of ```0.0 -> 25.5```. On the other hand, if we want more precision and negative representation, we could use 12-bits with ```0.01``` as a fraction, and an offset. The second fractional signal also contains an explicit minimum and maximum, which is limited by 12-bit that can represent 4096 different numbers, and by factoring in the offset, and using half of the range for negative representation, it ends up with the limited range of ```-20.48 -> 20.47```.
|
|
|
|
|
|
```
|
|
|
BO_ 500 IO_DEBUG: 4 IO
|
|
|
SG_ IO_DEBUG_test_unsigned : 0|8@1+ (1,0) [0|0] "" DBG
|
|
|
SG_ IO_DEBUG_test_signed : 8|8@1- (1,-128) [0|0] "" DBG
|
|
|
SG_ IO_DEBUG_test_float1 : 16|8@1+ (0.1,0) [0|0] "" DBG
|
|
|
SG_ IO_DEBUG_test_float2 : 24|12@1+ (0.01,-20.48) [-20.48|20.47] "" DBG
|
|
|
```
|
|
|
|
|
|
Observations
|
|
|
* Fractional signal is calculated as: [calculated value] = [offset] + [scale] * [raw value]
|
|
|
* IO_DEBUG_test_float1: variable is calculated as ``` 0 + 0.1 * [raw value] ```.
|
|
|
* IO_DEBUG_test_float2: variable is calculated as ``` -20.48 + 0.01 * [raw value] ```.
|
|
|
|
|
|
## Little Endian Examples
|
|
|
|
|
|
Signals that are defined as Little Endian in the DBC are easier to edit manually without a UI based DBC editor. This is because when we indicate that an LSB of a signal is "4" and is a 14-bit signal, then it is easier to understand the bounds of this signals are `b17 ... b4`.
|
|
|
|
|
|
## Big Endian Examples
|
|
|
|
|
|
Big endian bits are not what they appear to be if you design the DBC manually. *It is relatively difficult to design a big endian DBC without a UI based editor*. Let us consider some examples:
|
... | ... | |