Jump to content

Thunder CAN - Expressing negative numbers in binary


mikegt4dude

Recommended Posts

Usually there is good info in the "test calculator" to show how the parameter is scaled/stored but it looks like the detail for those parameters is missing.  Usually we use unsigned integers with an offset to allow for negative values, so this is probably what you are seeing.  I suspect it will be something like a 3G offset, so the accel can read from -3G to +3G.  I will see if I can get some more detail for you tomorrow.  

Link to comment
Share on other sites

Thanks Adam, To be honest I had not checked Test calculator but now that I look at it, I see why I needed * 0.001 - 30. Over CAN I'm only getting a positive number out and I can't tell whether it's forward or backward. On the ECU, Forward acceleration shows as negative and braking force shows as positive I'm not sure if this is correct but I've done a leveling calibration before and no change to that.

 

Stored in ECU with:
ECU Resolution      = 0.001 G
ECU Width (bits)    = 16
Display Offset    = 30 G
Minimum           = -10 G
Maximum           = 10 G

Link to comment
Share on other sites

13 minutes ago, mikegt4dude said:

n the ECU, Forward acceleration shows as negative and braking force shows as positive I'm not sure if this is correct but I've done a leveling calibration before and no change to that.

That is opposite to how most would want it.  You should be able to correct that with the "orientation correction" setting.

I just relised why my test calculator didnt work - I wasnt using a thunder...

The test calculator is actually very handy to see the effects of scaling/offsets etc.  Have a play with that calculator bit at the bottom.

2 minutes ago, mikegt4dude said:

Just thought on it a bit further, the reason it's -30 is so if it wanted to display -30 it would send 0, Now I just need to know which direction is which

Correct, -30G would be sent over CAN as "0".  +30G would be "60000".

fCFybo6.png

 

Link to comment
Share on other sites

Riiiiiiight, Orientation correction is what I'm missing all along, the CAN value should be fine once I sort this. So it says if the pin header is facing the front of the car it should be zero, I have it above the tunnel mounted flat just behind the ABS sensor (fluked a good choice) but the pin header is 90 deg CCW of the front of the car, Not sure what value that should equate to but it takes 180 max

 

Okay, I just realised it takes -180 as well, so ECU pin header facing passenger side, the front of the car should be 90deg CW in relation to the ECU so I'm guessing that's what I should put

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...