Bitwise AND operators , interpreting Engine Status

Discussions on CAN mapping for ECUs, sensors, PDMs, and more.
Post Reply
Posts: 69
Joined: Mon Jan 29, 2018 11:20 pm

Bitwise AND operators , interpreting Engine Status

Post by Canyonfive »

So, I'd like to map a channel for my clutch switch which is wired to my megasquirt.

The clutch switch is wired to "Launch in" so when that is active my clutch is depressed.

"Launch in" is located in Engine Status 2, status1-8 These bitfield variables is a combination of binary bits about engine status. These are used to drive various
status indicators.

This is broadcast on decimal ID 1530 with an offset of 1

This thread explains something that I don't understand. Bitwise AND operators. It also explains how this bit field works. ... 00&t=73499
More explaining, ... 5-136.html

I can easily map engine status 2 into Racecapture, my question is, using lua how would I evaluate the integer sent to see if "Launch in" is active?

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

Re: Bitwise AND operators , interpreting Engine Status

Post by brentp »


You can do this in 2 steps:

Step one, map a CAN channel for the bit field you want. This will result in a channel with a 0 or 1 value.

Step two, if you want to do additional processing in Lua, you can fetch that channel value by name, and then do what you need with that value. Use the getChannel() function: ... r_name_.29
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

Post Reply