Notice the alternate name of the Ports pins. The AVR microcontollers are designed to allow dual use of most of its pins. This has the advantage of allowing a developer to use these pins as I/O pins if the function they are provided for is not being utilized.
In this AVR tutorial we are only concern with the pins in there Digital I/O function, so for now just forget they have alternate capabilities.
The pins of the AVR microcontroller are not fixed as input or output at the manufacturing stage, these pins are software configurable which is the topic of the section below.
DDRx is an 8-bit register which stores configuration information for the pins of Portx. Writing a 1 in the pin location in the DDRx makes the physical pin of that port an output pin and writing a 0 makes that pin an input pin.
Note: Each physical pin of a port is configured independently and thus a port can have some of its pins configured as input an the others as output pins.
PINx - Port X Input Pins Register
PINx is an 8-bit register that stores the logic value, the current state, of the physical pins on Portx. So to read the values on the pins of Portx, you read the values that are in its PIN register.
PORTx - Port X Data Register
PORTx is an 8-bit register which stores the logic values that currently being outputted on the physical pins of Portx if the pins are configured as output pins. So to write values to a port, you write the values to the PORT register of that port.
AVR Tutorials hope this AVR tutorial on the AVR microcontroller digital I/O ports was benificial to you and looks forward to your continued visit for all your microcontroller tutorial needs.