Now we run into another dilemma. We have one more command and three more responses to decode. While we could use groups and conditionals to decode all six commands and responses, this is not very efficient and quickly becomes unwieldy for protocols with large numbers of commands. The BRANCH keyword solves this dilemma.
We noted that the FIELD statements we quoted above serve to decode a Set Actuator and Read Sensor command in FP. If you look at the full FP decoder (on file FP.DEC), you will not find those statements appearing as such.
What you will see is:
FIELD command_code (Fixed 1 Byte) (Table tableCommands) IN_SUMMARY "Command/Response" 150 "Command"
BRANCH (FromTable tableCommands command_code)
FIELD checksum ;
The BRANCH statement causes a jump to a statement specific to the command code. The target of the branch is provided by a Branch Method, in this case FromTable, which extracts the branch item from the table entry specified by the parameters.