When a bit manipulation instruction "P0.0 = 0;" is executed for other bits of the same port, the value of port P0.2 changes to 0 and the TxD signal line is fixed at a low level. When the bit manipulation instruction "P0.0 = 0;" is not executed, no problem occurs.
What should we do to execute a bit manipulation instruction that has no effects on the UART communication?
Judging from the situation, it is possible that the PMS register is set to 1 instead of 0.
First, please check the setting value of the PMS register.
Bit manipulation instructions on a port are handled according to steps (1) to (3) (read-modify-write instruction) below. When the PMS register is set to 0, the output latch value of a port in output mode is read out from the register in step (1), and the value read out is written back to the register in step (3). Accordingly, the value of the output latch will not inadvertently change.
However, when the PMS register is set to 1, the state of a pin is read out instead of the output latch value in step (1). If the TxD1 function outputs a value of 0 during step (1), the value read out is set to 0, which also changes the value to be written back in step (3) to 0. Consequently, the pin is fixed at a low level after that.
Step (1): Read out the value of a port in bytes.
Step (2): Perform calculations over the target bits.
Step (3): Write the calculation result back to the port in bytes.
To execute bit manipulation instructions for ports, the value of the PMS register must be set to 0.