This question already has an answer here:
I have confusion in assigning ports as input or outputs in 8051 microcontroller.
As I have done programming with atmel atmega16 and variants we clearly have DDR registers to assign ports as inputs or outputs but not both in same program(or it might be both since I dont know if it can).
If it can be both(i/p and o/p) how would the microcontroller does this?
In a program while interfacing a 16x2 LCD with 8051 the P1.0 is used as input to find the value as busy flag and is used as an output pin when sending commands and data.
Please provide explanations.