Reverse engineering and bitmasking confusion.

Discussion on the Lua Scripting capabilities for RaceCapture/Pro. Also see the <a href="">Lua Scripting Guide</a>

Moderators: JeffC, stieg

Post Reply
Mitch Detailed
Posts: 5
Joined: Tue Feb 07, 2017 4:29 am
Location: Murfreesboro TN

Reverse engineering and bitmasking confusion.

Post by Mitch Detailed »

I'm trying to get a solid understanding of how to apply a bitmask to read variables within bytes of information on the bus. The platform is a w211 E55 AMG, and there's quite a bit of information offset/requiring a bitmask and odd length in bits.

I figure i'd set up a real example in hopes of assistance.

Can Id= 0x236 (566)
Information is in the first 2 bytes, So:
Length=2 and,
The Variable inside the 2 bytes is xxx##### ######xx, So:
Bitmask= 0x1FFC

Steering Wheel Centerline value =1024,
Locked Left value= 776
Locked Right value = 1272

run the variable through the formula x*1/8+-128,

you get a min/max of -31 and 31

Thanks in advance - Mitch
Last edited by Mitch Detailed on Tue May 09, 2017 3:58 am, edited 1 time in total.

Site Admin
Posts: 5986
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Hi Mitch,

Our next-gen CAN bus support should handle the things you'll need. Demo video here:

These new mapping capabilities should handle nearly all use cases; for things that fall through, you'll still be able to map channels in Lua, where you'll be able to apply arbitrary logic, bitmasks using Lua's bitop libraries, complex formulas and algorithms and so on.

Hope this helps!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

Post Reply