6.2 PORTA
6.2.1 PORTA Data and Direction Control
PORTA is 8 Bit bi-directional port. Its corresponding data direction register is TRISA. Setting 1 bit of
TRISA to be 1 can configure the corresponding pin to be input. Setting 1 bit of TRISA to be 0 can configure
the corresponding pin to be output.
Reading PORTA register reads the pin status. Writing PORTA write to port latch. All write operation is
read-change-write. Hence, write 1 port means read the pin electrical level of the port, change the value and
write the value into port latch. Even when PORTA pin is used as analog input, TRISA register still control the
direction of PORTA pin. When use PORTA pin as analog input, user must make sure the bits in TRISA register
are kept as 1.I/O pin is always read 0 when configured as analog input.
Registers related to PORTA ports are PORTA、TRISA、WPUA、IOCA、ANSEL0 and etc.
PORTA data register PORTA (05H)