Purpose of Using Command Byte A: Command byte A is used select modes, working functions of the ports. So the importance of using command byte A is that we can define on which mode it will be working on and which port will be used for which function such as input or output.
For example, consider the following bit format,
Here, we are putting value 1 in position 7 which is defining that this is command byte A. After that we are putting 0 & 0 in positions 6 & 5 to define that this is working on mode 0 from group A. Then we are putting 0 in position 4 to define that port A will work as output, if it was 1 then port A would work as an input. Then putting 0 in position 3 to define that the upper half of port C will work as an output, if it was 1 then the upper half of port C would work as an input. Then putting 0 in position 2 to define that this will work as mode 0 from group B. Then putting 1 in position 1 to define that port B will work as an input, if it was 0 then port B would work as an output. Then putting 0 in position 0 to define that the lower half of port C will work as an output, if it was 1 then the lower half of port C would work as an input.
So in this way the command byte A is used to select modes and functions
Purpose of Using Command Byte B: Command byte B is used when port C is used as a control, which is in mode 1 and 2. We can use this to define which pin of port C will work and what will be the value of the pin.
For example, considering the following bit format of command byte B,
The port C has 8 pins. Supposing that we want to select the 2nd pin. Thus we are putting the 3 digit binary equivalent of the position in the position 1, 2 & 3 of command byte B as 0, 0, 1. Now to give a value to the selected pin we are putting 1 in position 0 of command byte B, we can also put 0 to deactivate it.