Quote Originally Posted by leisryan View Post
Sir Darrel:
I'm a bit confused,does it mean when I'm trying to read a Port configured as output in PIC16F877A, I will get the state of the Pin even if it's already an output, rather than the state of the Latch that switch that particular pin to output? is "LAT*" a work-around in PIC18F series?
Exactly!

On 16F's, reading a pin in output mode reads the state of the pin itself, not the state you told it to output.

Usually they are the same thing, unless there is capacitance on the pin that makes it change slowly. Or if the pin is in analog mode, the digital input is disabled and ALWAYS reads 0.

On the 18F's, the LATx latches allow you to read the requested output state regardless of the actual state of the pin. This makes it easy to overcome the R-M-W problem found on the 16F's.
<br>