There's a bug in our rspStatus group. Here's the code again:
GROUP FIELD rspStatus (Fixed 3 Bits) (Hex) "Status" NO_MOVE
{
RESERVED (Fixed 5 Bits)
FIELD alarm_bit (Fixed 1 Bit) (Binary) "Alarm"
FIELD power_bit (Fixed 1 Bit) (Binary) "Power"
FIELD test_bit (Fixed 1 Bit) (Binary) "Test mode"
}
Notice that the first 5 bits are skipped in the RESERVED statement, and the last three are decoded. The GROUP FIELD, however, decodes the first three bits in the byte. In order for the GROUP FIELD to decode the correct 3 bits, we need to move the bit pointer 5 bits forward first.
START_BIT Methods are used to move the bit pointer forwards and backwards in the layer. The Move method simply moves the bit pointer backwards or forwards the specified number of bits. Other methods move the pointer to certain fields, or move the pointer to the beginning or end of the layer.