As far as I understand, the 8051 microcontroller is able to read a pin

(1) by reading the actual pin, assuming the nFET is in cutoff (so a logic 1 is written before reading the pin)

(2) by reading the corresponding latch

Now is it true to assume that reading the latch only makes sense when using the pin as an output? And what are the advantages of reading the latch (which is used in e.g. read-write-modify instructions) instead of the actual pin?

Reading the buffered output has an advantage when you want to do something like read-modify-write. E.g. you want to take the current value of the pin and logically AND it with some other value:

PIN = PIN & Value;


If the PIN is not buffered you won't be able to read it's value, as it is output, not input.

To change the state of a single I/O output latch while leaving the others unaffected, it's necessary for the 8051 to read eight latches, change one of the bits, and write the result back. If that read operation were to report the state of the pin rather than the latch, then changing the state of one pin while another pin was being used as an input but pulled low would cause that other pin to start outputting low. Not fun.