In fact, some lines can be used for input
and some lines for output depending on
the pattern in the Data Direction Register
(DDR).
Processor places an 8-bit pattern into a
DDR.
If a given bit position in the DDR is 1, the
corresponding data line acts as an output
line, otherwise it acts as an input line.