The PIC microcontroller designers want the PIC microcontroller to be as flexible as possible. To this end they allow the PIC microcontroller's user to set exactly which of the 13 PIO pins are inputs and which are outputs. This means that we could have anything from 13 inputs to 13 outputs, depending on whether we are flashing lights or reading lots of switches.
Each PIC microcontroller input/output port has a matching register which determines the mode of each of the pins. If the bit in the "data direction register" is set this means that the port is configured as an input. If the port is an input we can read the state of a voltage on that pin by reading from the port. We will see how to do this later in the course.
If the bit in the register is clear this means that the port is an output. If a bit is an output we can change its state by loading values into the input/output register. Note that this technique effectively uses software (our program) to configure how the hardware behaves.
There is nothing wrong with having some pins as inputs and others as outputs in a given port. If I want to make bits 0, 1, and 2 outputs and bits 3, 4, 5, 6 and 7 inputs I simply have to calculate the right number to place in the data direction register:
Remember that if the bit is set high this means we are an input. This means that I need have a "high" value for bits 3, 4, 5, 6 and 7. The number I should put into the data direction register for the port should be:
128+64+32+16+8 = 248 or 0xf8
Note that I have given the values in HEX as well as decimal. HEX is easier to convert to patterns of bits, and is often used in embedded programs for this reason.