This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS0914: Issue while receiving CAN database (DBC) Signals with Signed value type

Part Number: TMS570LS0914

I am working on CAN communication and I have come across a CAN database (.dbc) file which has signals with "Signed" value type & lengths as shown in snap below:

Now, while testing I have set the Physical value of the signals as -10 on the CAN Bus Analysis Software i.e. BUSMASTER (Refer below snap) & I'm checking whether I'm receiving the exact data at Microcontroller side.

But as shown in the snap above, raw value is changing depeding on the data length of the signals for the same physical value and so that I'm receiving the wrong physical value at Microcontroller side. There is no issue while transmitting "Signed" value type signals.

So how to handle the "Signed" value type of signals at microcontroller side? Please share the example code/code snippet if you have.

Please help. Thanks in advance !

  • Hi Harshal,

    But as shown in the snap above, raw value is changing depeding on the data length of the signals for the same physical value and so that I'm receiving the wrong physical value at Microcontroller side. There is no issue while transmitting "Signed" value type signals.

    The raw value is not changing, as you give the physical value in negative number so the raw value is just showing 2's complement value of the corresponding data.

    10 in binary         = 0000 0000 0000 1010

    1's complement  = 1111 1111 1111 0101

    2's complement  = 1111 1111 1111 0110 (1's complement + 1)

    So, -10 will be represented as  = 1111 1111 1111 0110 = 0xFFF6.

    On my controller side you just need to declare one "signed short" variable to operate on the corresponding data.

    Just look the below code to understand:

    --
    Thanks & regards,
    Jagadish.