RL78/F13, F14 CHAPTER 7 TIMER RJ
R01UH0368EJ0210 Rev.2.10 565
Dec 10, 2015
7.5.5 Procedure for Setting Pins TRJO0 and TRJIO0
After a reset, the I/O ports multiplexed with pins TRJO0 and TRJIO0 function as input ports.
To output from pins TRJO0 and TRJIO0, use the following setting procedure.
The 20-pin products do not have TRJO0 and TRJIO0 pins.
Changing procedure
(1) Set the mode.
(2) Set the initial value/output enabled.
(3) Set the port register bits corresponding to pins TRJO0 and TRJIO0 to 0.
(4) Set the port mode register bits corresponding to pins TRJO0 and TRJIO0 to output mode.
(Output is started from pins TRJO0 and TRJIO0)
(5) Start the count (TSTART in TRJCR0 register = 1).
To input from the TRJIO0 pin, use the following setting procedure:
(1) Set the mode.
(2) Set the initial value/edge selected.
(3) Set the port mode register bit corresponding to TRJIO0 pin to input mode.
(Input is started from the TRJIO0 pin)
(4) Start the count (TSTART in TRJCR0 register = 1).
(5) Wait until the TCSTF bit in the TRJCR0 register is set to 1 (count in progress).
(In event counter mode only)
(6) Input an external event from the TRJIO0 pin.
(7) The processing on completion of the first measurement is invalid (the measured value is valid for the second and
subsequent times). (In pulse width measurement mode and pulse period measurement mode only)
7.5.6 When Timer RJ is not Used
When timer RJ is not used, set bits TMOD2 to TMOD0 in the TRJMR0 register to 000B (timer mode) and set the TOENA
bit in the TRJIOC0 register to 0 (TRJO output disabled).
7.5.7 When Timer RJ Operating Clock is Stopped
Supplying or stopping the timer RJ clock can be controlled by the TRJ0EN bit in the PER1 register. Note that the following
SFRs cannot be accessed while the timer RJ clock is stopped. Make sure the timer RJ clock is supplied before accessing
any of these registers.
Registers TRJ0, TRJCR0, TRJMR0, TRJIOC0, and TRJISR0.
7.5.8 Procedure for Setting STOP Mode (Event Counter Mode)
To perform event counter mode operation during STOP mode, first supply the timer RJ clock and then use the following
procedure to enter STOP mode.
Setting procedure
(1) Set the operating mode.
(2) Start the count (TSTART = 1, TCSTF = 1).
(3) Stop supplying the timer RJ clock.
To stop event counter mode operation during STOP mode, use the following procedure to stop operation.
(1) Supply the timer RJ clock.
(2) Stop the count (TSTART = 0, TCSTF = 0)