Skip to main content
Renesas India - Knowledgebase

Timer pulse output stops when changing port setting

Last Updated:01/16/2018


While timer output (TO03) function is being performed from the port (P31) in P3 group, bit manipulation instructions are to be executed for different bits of the same port group. 
Judging from the diagram of port blocks, I think that the settings of the PMS register will not affect the output of the port; however, the timer output is no longer available after setting the PMS register to 1. What is the cause of this ?


To comply with IEC 60730, the PMS register is provided to allow the read out of the state of a pin, not an output latch value, when the port is in output mode. While the PMS register is set to 0, the state of a port pin is read out when the port is in input mode, and the output latch value is read out when the port is in output mode, respectively.
Bit manipulation instructions on ports are executed according to the steps below.
While the PMS register is set to 0, the output latch value of the P31 port is read out from the register in step (1), and the value read out is written back to the register in step (3). If port P31 has been set to 0 by the timer (TO03) output function, the output latch value read from P31 is held at 0 even if a bit manipulation instruction is executed for other bits, which allows output from the timer (TO03).
However, if the PMS register is set to 1, the state of a pin, not the output latch value, is  read out in step (1).  At this time, if the state of the pin is high level (that is, the timer outputs "1"), "1" is read out in step (1) and the value "1" is written back in step (3), which changes the output latch value to 1. The TO03 outputs the value to the pin. This value is obtained by performing an OR operation with the output latch value from P31. In short, if the output latch value of P31 is 1, the pin output is fixed at a high level. This is the phenomenon that occurred.

Step (1): Read out the value of a port in bytes.
Step (2): Perform calculation over the target bits.
Step (3): Write back the calculation result to the port in bytes.

To perform bit manipulation for ports, the value of the PMS register must be set to 0.

Suitable Products