describes the settings required to configure a specific port pin to either input or output. If selected for input, the pin may be selected for either an input pin or to operate in the high-impedance (Hi-Z) mode. In Hi-Z mode, the input appears as high impedance to a particular pin. If selected for output, the pin may be further configured for either logic low or logic high.
port pins are usually configured at the beginning of a program for either input or output , and A code example is provided below to show how ports are configured. Note that because we are using the C programming language with a compiler include file, the register used to set the pins as either input or output, and then the data register (PORTx) is used to set the pins as either input or output, and then the data register (PORTx) is used to set the initial value of the output port pins.