wastegate Posted October 27, 2022 Report Share Posted October 27, 2022 Hi Link, I asked this question on the FB group but seems it was a stupid question and got usual Toxic replies. It might be a simple one but I feel like I'm doing it wrong or it's the limits of what the CAN calculation can do.. I have a J1939 CAN message coming into the G4X. CAN ID 419362819 (Extended) J1939 Transmission Oil Temperature 0.03125/unit with -273 offset. Link CAN Start Position 39 Width 16 LS First Unsigned. Raw CAN message = 9881 9881 x 0.03125 - 273 = 35.78c which is 100% what I want (Cold Transmission). However I can not put in <1 numbers in the multiplier So I'd need to multiple 9881 x 3125 / 100000 - 273 but I can't have a divider >10000. Doing 9881 x 312.5 would be ok but I can't have a decimal in the multiplier so I'd need to round up to 313 which results in a inaccurate final temp. For now I'm just piping the Raw CAN to a Math Block and doing the required math then outputting to a GP Temp but I'd really like if there is a simple way to get the CAN itself to do the math right? Quote Link to comment Share on other sites More sharing options...
Vaughan Posted October 27, 2022 Report Share Posted October 27, 2022 3125 / 100,000 = 1/32 Quote Link to comment Share on other sites More sharing options...
wastegate Posted October 27, 2022 Author Report Share Posted October 27, 2022 So using 32 as the divider certainly works, but rounds to the whole number. Expected Result = 35.78 result using /32 = 35 Quote Link to comment Share on other sites More sharing options...
Vaughan Posted October 27, 2022 Report Share Posted October 27, 2022 what runtime are you feeding the value into and what is the raw CAN value for that example? Quote Link to comment Share on other sites More sharing options...
wastegate Posted October 27, 2022 Author Report Share Posted October 27, 2022 If anything, I want it to goto GP Temp 3 so I can log it, and also push it to my dash. At the moment it's going there but only via a math block to get the correct result. Raw CAN value example is 9881 (as stated in OP) How would you ingest this data into the ECU? Given it has a 0.03125/bit and -273c offset? Quote Link to comment Share on other sites More sharing options...
Adamw Posted October 27, 2022 Report Share Posted October 27, 2022 Doing as Vaughan says would give you the correct value received into the ECU. However GP Temps only have a 0.1°C resolution so your 35.781 CAN analog will be rounded to 35.8°C Are you really worried about the 0.02°C? Quote Link to comment Share on other sites More sharing options...
wastegate Posted October 27, 2022 Author Report Share Posted October 27, 2022 Not sure what I did wrong Adam on why it rounded so much, no of course not 0.02 :D. But thanks for the help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.