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

2 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.

2 Likes

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