×

Sale ends todayGet 30% off any course (excluding packages)

Ends in --- --- ---

# Steering Angle Worked Example - help

### Tech Articles

Discussion and questions related to the course CAN Bus Communications Decoded

Hello,

I did this on my own vehicle, and I became confused with the data I was seeing. I saw the changes to my inputs show up on bytes 1, 2, 5, and 6. bytes 1 and 5 were transmitting the same thing. 2 and 6 didn't appear to be the same. 6 was unreadable because the values were constantly changing between three or four different numbers. I focused on bytes 1 and 2. Byte 1 was the high byte, and byte 2 was the low byte, transmitting big-endian if I understand that correctly. When I concatenated it as big-endian and converted it to Dec., it didn't make sense. I wasn't able to determine a scaling factor, but if I concatenated it using bytes 2 and 5 as little-endian, I could determine the scaling factor as 15, and the numbers looked correct. Here is a link to the numbers and calculations. https://docs.google.com/spreadsheets/d/1MK-5QlXULY7VLIuoQndFy75x5lTC-3Vqo8egkgtolgg/edit?usp=sharing I'm confused about how that works out.

Not sure your question is clear. You have translated it correctly in the second example, the data is signed twos-complement big-endian. In the 90 deg example, 0x05 is your most significant byte and 0x95 is least significant. 0x595 is the result.

Note the common scaling factor for most steering angle sensors that I have tested is 16bits = 1deg. In other words, divide by 16.

So 0x595 = 1429. 1429/16 = 89.3deg.

Hi Adam, thanks for the reply. I'm new to this, and I think the big and little-endian transmissions are what I don't understand completely. Are the bytes transmitted 0 being the first transmitted and 7 being the last?

Using the 90-degree example, in my case byte 1 carries the most significant byte (0x05), and byte 2 carries the least significant (0x95) and would be considered big-endian? If I understood the description in the course, when you concatenate the two bytes in big-endian, the result would be 0x955. It wasn't specifically described, but what I picked up from the graphic examples was, the concatenated order was reversed from the transmission order. Did I understand that incorrectly?

For the worked example in the course, Zac mentioned it was transmitted in little-endian, so if we use my numbers in little-endian byte 1 would carry the least significant (0x95) and byte 2 would carry the most (0x05)? When he concatenated the two, he started with the most significant followed by the least so the result would be 0x595.

I really appreciate the help, I'm slowly catching on. Thanks for the information on the 16bits = 1deg. I made that change on the sheet.

Are the bytes transmitted 0 being the first transmitted and 7 being the last?

Thats something you need to be careful of as there is no real convention with byte numbering. Leftmost byte is the first and the rightmost is the last, but how they are numbered can vary. Some guys seem to start at 1, some at zero etc. I use the same convention as you have used in your sheet which is the leftmost byte is Byte 0.

in my case byte 1 carries the most significant byte (0x05), and byte 2 carries the least significant (0x95) and would be considered big-endian?

Yes, if the most significant byte is first (leftmost) this is big endian, or sometimes referred to as Motorola, MSB or "normal" in Motec.

If I understood the description in the course, when you concatenate the two bytes in big-endian, the result would be 0x955. It wasn't specifically described, but what I picked up from the graphic examples was, the concatenated order was reversed from the transmission order. Did I understand that incorrectly?

No that is where you are going wrong, if it is big endian then you can just concatenate them exactly as they are received - so the result would be 0x595 in this case.

With little endian you reverse them first (to effectively make them big endian) then concatenate them. So if the same example data was little endian the result would be 0x955.

Excellent, thank you, Adam! That clears it up. I appreciate the help.

We usually reply within 12hrs (often sooner)

#### Need Help?

Need help choosing a course?

Experiencing website difficulties?