面的说法读LAT也是可以啊。( Writes to the latch, write the latch.)
All port pins have three registers directly associated
with their operation as digital I/O. The Data Direction
register (TRISx) determines whether the pin is an input
or an output. If the Data Direction register bit is a ‘1’,
then the pin is an input. All port pins are defined as
inputs after a Reset. Reads from the Data Latch register
(LATx), read the latch. Writes to the latch, write the
latch. Reads from the port (PORTx), read the port pins;
writes to the port pins, write the latch. |