signed word

hello,
I need in the Channel Description File a signed word value. (I need to combine 2 bytes). The value must be -32.768 until 32.767. Is it possible to define a value like units=“signed word” ??

greetings, Michael

Yes, you do it in conversion, for example: conversion=“V-32768”

this is not working!
B0 is MSB, B1 is LSB. Value is sendet as signed word:
I try: <value name=“Motorstrom” units=“A” offset=“0” length=“2"conversion=”(B1+(B0*256))-32768">

I try with Two’s complement:
<value name=“Motorstrom” units=“A” offset=“0” length=“2"conversion=”((B1+(B0*256))-65536)+1">
This shows a correct value, if the incoming value is negative, positive value is wrong!

Why such difficulties if there is a “Big endianness” / “little endianness”

Yes, use the endianess setting in XML, and when sending the signed value, convert it to unsigned and use conversion in XML to get it back to signed. Example:

// sending data
int16 value = -555;
uint16 sendValue = value + 32768;
// write ‘sendValue’ to RealDash CAN frame

Then set the conversion in XML as: conversion=“V-32768” to receive original signed value into RealDash.

Thanks for the adwise!
But I got the same result as before.
Here is my XML:

The incoming values are:
Positive value: 00 / 92 (MSB / LSB) - Result in Realdash (not exact, he values change) = -3250
Negative value: FF / F4 (MSB / LSB) - Result in Realdash (not exact, he values change) = 3276

RealDash believes everything right! What doesn’t suit you?
IMG_20200323_190302.jpg

Here is the full calculation:
Convert to decimal …
IMG_20200323_192854.jpg
We use the formula …
IMG_20200323_192814.jpg

The calculation is right, but the incoming value is not coded for the calculation.
but I think the problem is: The sender coding the signed word in Two’s complement!

Wikipedia:
“The two’s complement of an N-bit number is defined as its complement with respect to 2N. For instance, for the three-bit number 010, the two’s complement is 110, because 010 + 110 = 1000.
—> The two’s complement is calculated by inverting the digits and adding one.”

Like this:

Positive value: FF / F4 = 11111111/11110100 → inverted 00000000/00001011 + 1 = 000000000001100 = decimal 12! This is correct!!!

Negative value: 00 / 92 = 00000000/10010010 → inverted 11111111 01101101 + 1 = 11111111 01101110 =
decimal -146! This is correct!!!

Here is a online calculator: https://manderc.com/concepts/umrechner/index.php
But how to realize this calculation in Realdash??

Why are you wise guys! I send what you want byte numbers in RealDash at least 1 byte, at least 2 byte, at least 4 byte. Byte inversion via L / B ENDIANNES, a formula for calculating a negative number and everything works.
Why difficulties? What do you want to get then? A machine for printing dollar bills? Or a time machine?

Come on, if you want to help, be polite.

Sorry, I went too far ((

Is there a NOT ~ (Tilde) operator working in Realdash?

No, the conversion does not support the tilde.