START_BIT Syntax

A START_BIT clause is placed after the name. The keyword is followed by a call to a StartBit method that serves to reposition the pointer before decoding of the field starts.

Move Method: Move is a StartBit method that moves the pointer a specified distance from its current position. The first parameter is a count and the second a unit. If the second parameter is omitted then "bytes" is assumed. If the count is negative then the pointer is moved backwards; if positive then the move is forwards.

To fix our bug, we'll add a START_BIT (Move 5 Bits) clause to our rspStatus group.

GROUP FIELD rspStatus START_BIT (Move 5 Bits) (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"

}

Now our GROUP FIELD will decode the correct 3 bits.