Torque

Forums

Forums

Guest  

Show or hide header
Welcome Guest, posting in this forum require registration.




Torque » Torque OBD ECU Scanner » Torque Discussion / Ideas » How to decode CAN signal with several variables

Pages: [1]
Author Topic: How to decode CAN signal with several variables
RKP
Member
Posts: 8
Post How to decode CAN signal with several variables
on: February 15, 2022 (GMT)

Hi!

I’m not a programmer, so I need some help to understand processes.
I have one PID for four sensors.

My Request DATA to CAN by Torque was 03 22 21 4A 00 00 00 00
I got this data by CAN-logger.

I have several Respond DATA frames from CAN-bus:

10 0F 62 21 4A 02 6A 00
10 0F 62 21 4A 02 68 00
10 0F 62 21 4A 02 65 00
10 0F 62 21 4A 02 6D 00
10 0F 62 21 4A 02 6F 00

As I know this respond contains data of four sensors. I don’t know exactly how to write formulas for them. Anyway I’ve tried to write them and All formulas coincided with reality.

1st sensor formula INT16(A:B)/32 (real physical quantity ~19.4)
2nd sensor formula INT16(C:D)/32 (real physical quantity ~1.25)
3rd sensor formula INT16(E:F)/512 (real physical quantity ~7.139)
4th sensor formula INT16(G:H)/512 (real physical quantity ~7.258)

Could you please explain to me how each formula works?
What data is taken from which byte to obtain the desired value of a physical quantity? I’m a little confused about how this works.

Thank you.

RKP
Member
Posts: 8
Post Re: How to decode CAN signal with several variables
on: February 15, 2022 (GMT)

Some additional DATA

03 22 21 4A 00 00 00 00
10 0F 62 21 4A 02 6A 00
10 0F 62 21 4A 02 65 00
03 22 21 4A 00 00 00 00
10 0F 62 21 4A 02 68 00
10 0F 62 21 4A 02 6A 00
21 2A 0E 47 0E 7A FF 47
03 22 21 4A 00 00 00 00
22 FF 39 00 00 00 00 00
03 22 21 4A 00 00 00 00
10 0F 62 21 4A 02 6A 00
03 22 21 4A 00 00 00 00
10 0F 62 21 4A 02 6D 00

I’m confused by these rare response data packets
21 2A 0E 47 0E 7A FF 47
and
22 FF 39 00 00 00 00 00

piemmm
Administrator
Posts: 6629
Post Re: How to decode CAN signal with several variables
on: February 15, 2022 (GMT)

Hi

That’s a mode 22 PID, so in the PID Editor you would put the following for the PID request (as the mode and PID might as well be together in the single field):

PID: 22214A

Then for the equation you would have:

Equation: INT16(A:B)/32

You would then just repeat add 3 more PIDs with the same PID as above in the PID management screen with the remaining equations, so in total you would end up with a PID for each sensor you wish to read.

The app will only request the PID once, and then run the equation 4 times for you automatically.

However, the replies you have posted for that PID do not match the variables you are attempting to get as the bytes do not exist in the reply – there are not enough bytes in the reply and you appear to be missing the checksum from the end as well (and some of the header bytes)

Your reply starts with 62 for mode 22(61 for mode 21), then the PID you requested (214A). The rest of your reply are your data bytes (A,B,C,etc) represented by groups of 2 hex digits’00’ etc.

You would be better off running the PID through Torque in the PID editor and pressing the test button – it would likely make more sense that whatever that can logger is doing

RKP
Member
Posts: 8
Post Re: How to decode CAN signal with several variables
on: February 17, 2022 (GMT)

Thank you Ian!

One more question.

I have response from ECU in HEX 07 62 2B 00 20 80 00 00

It contains three variables named X,Y,Z with just two states: “0” and “1”

I have info that:
X states are defined in 7th bit of 2nd byte, i.e. 07 62 2B 00 20 80 00 00
Y states are defined in 5th bit of 1st byte, i.e. 07 62 2B 00 20 80 00 00
Z states are defined in 7th bit of 1st byte, i.e. 07 62 2B 00 20 80 00 00

in BIN it looks like 00100000 10000000 00000000 00000000

How should I write each formula for X, Y, Z?
How to extract bits from bytes in Torque?

piemmm
Administrator
Posts: 6629
Post Re: How to decode CAN signal with several variables
on: February 17, 2022 (GMT)

Hi!

You’ll probably want to read this page: https://wiki.torque-bhp.com/view/Equations

Look for the ‘BIT’ function

Pages: [1]
WP-Forum by: Fredrik Fahlstad, Version: 2.4
Page loaded in: 0.02 seconds.

  Follow me on twitter