CAN Bus Bitfields and Flags
-
A Can Bus Bitfield is a special case of a can bus data channel that is used to represent the state of one or more systems of the transmitting device.
-
A Bitfield is defined when the channel internal units are set to the xxx BITFIELD type.
-
A Can Bus Flag can only be defined from an existing Bitfield.
-
The flag value is not stored but extracted from the parent bitfield at runtime.
The flag value is taken from a single Bitfield bit.
When that particular bit is equal to 1 then the Flag is active, when equal to 0 the Flag is inactive.
ex. Bit 3 represents the error status of a sensor.
The flag is active only when the value of the bitfield is equal to the enumeration value.
The flag is inactive when the bitfield has any other value.
ex. The bitfield represent the status of an Antilag system.
When the bitfield value is 0 the system is OFF
When the bitfield value is 1 the system is ENABLED
When the bitfield value is 2 the system is ACTIVE
When the bitfield value is 3 the system is OVER TEMP
When the bitfield value is 3 the system is COOLDOWN
etc...
Separate enumeration flags can be defined for each state and are mutually exclusive.