CAN XML syntax question

Can’t seem to get my rear defrost to set indicator on/off…

here’s the CAN monitor and the code I have in the XML… i used to the type for the parking brake but doesnt seem to work…

(im using the “Rear Fog Light” target id for the rear-defrost button on my car)


@Kaelub If your rear defrost signal is hex 80 dec 128 i.e. bit 7 then your startbit needs to be 7 and not 4

2 Likes

what do you mean by bit 7…? like how or what are you deciphering that as bit 7?

Each of the numbers you see in the can monitor is an 8 bit number in hex format, which as the name implies has 8 bits, bit0=1, bit1=2, bit2=4, bit3=8, bit4=16, bit5=32, bit6=64, bit7=128 with a maximum value of 255 or FF in hexadecimal. If the number you have highlighted is 0 when the rear defrost is off and 80 when its on, this corresponds to bit7 and 128 in decimal

4 Likes

Ok, that worked… So here is another example…

Parking brake on and off…

am I limited to using the startbit method, or for on/off can I also use the “offset” and “length” method for making this work. Seems like you can use both ways.

No both methods can be used. In your Parking Brake example which is in frame 0x620, this is showing as 0x10 in hex and 16 in decimal, hence bit 4 in the last byte 7 of the frame. Each frame has 8 bytes (0-7) and each byte has 8 bits, therefore, total 64 bits (0-63).

Using startbit method, you are selecting the startbit position within the entire frame

value targetId=”164” startbit=”60” bitcount=”1”

Using offset method, you are selecting the byte within the frame, but then need to manipulate into the single bit of interest i.e. bit 4

value targetId=”164” offset=”7” length=”1” units=”bit” conversion=”V>>4”

The units=”bit” makes RealDash read only the bit in position 0, the conversion bit shift moves bit 4 (16) into the bit0 position. Hope this makes sense.

3 Likes

I believe that does make sense. Thank you! :slight_smile:

I got confused about the “InitialValue”.
In the docs referred as a “Value” property, but in the forum I found a discusion where referred as a “frame” property.
(Transmit CAN with scaling - #8 by realdashdev)

BTW in my case does not works (on android) in neither way.
My goal is define an outgoing frame with slow update, but requires to transmit the frame at the connection.
like this:

    <frame id="0x7F" writeInterval="900000" initialValue="true">
        <value targetId="211" offset="0" length="4"></value>        <!-- Date, every 1/4 hour -->
    </frame>

What is the correct way to achieve this ?

Another questions:
The frame data got as an unsigned value, but after the conversion the result can be negative. ATM the results maxed at 0.

i.e:

<value targetId="38" offset="22" length="1" conversion="-6+V*0.25" signed="true"></value> <!-- Ign final -->

so the retards would show as a negative value.

also want to do same with the temperatures.
<value targetId="152" offset="48" length="1" coversion="V-27"></value> <!-- Oil temp C, on B6 -->

is it possible somehow ?

And finaly about the “timeout” property.
Any chance to be fired just once or just fired after the first assigned frame occured ?
(maybe an option like as ‘autotimout’)

This is would be usefull where the definitions contains different frames (and those uses same target IDs) but the conncted device uses only one of the defined frames. So the other frames would not timed out and make the UI jumping…

“initialValue” is only used for ‘value’, and it simply sets the value of that input during startup, before connection has been established.

signed=“true” is necessary only if incoming data is an signed integer. The conversion attribute will make the value negative. If you don’t see negative values on RealDash gauges, check the value range on ‘Input & Values’.

As for a timeout, sounds too complicated for my ‘just returned from vacation’ brain.