Bitwise AND operators , interpreting Engine Status

Discussions on CAN mapping for ECUs, sensors, PDMs, and more.
Post Reply
Canyonfive
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.
Image

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

This thread explains something that I don't understand. Bitwise AND operators. It also explains how this bit field works.
https://www.msextra.com/forums/viewtopi ... 00&t=73499
More explaining, http://www.msextra.com/doc/pdf/html/Meg ... 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?

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

Re: Bitwise AND operators , interpreting Engine Status

Post by brentp »

Hi,

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.
https://wiki.autosportlabs.com/CAN_Bus_Integration

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: https://wiki.autosportlabs.com/RaceCapt ... r_name_.29
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

Post Reply