Datasheet
Section 13 Timer W
Rev. 3.00 Mar. 15, 2006 Page 212 of 526
REJ09B0060-0300
5. The TOA to TOD bits in TCRW decide the value of the FTIO pin, which is output until the
first compare match occurs. Once a compare match occurs and this compare match changes the
values of FTIOA to FTIOD output, the values of the FTIOA to FTIOD pin output and the
values read from the TOA to TOD bits may differ. Moreover, when the writing to TCRW and
the generation of the compare match A to D occur at the same timing, the writing to TCRW
has the priority. Thus, output change due to the compare match is not reflected to the FTIOA
to FTIOD pins. Therefore, when bit manipulation instruction is used to write to TCRW, the
values of the FTIOA to FTIOD pin output may result in an unexpected result. When TCRW is
to be written to while compare match is operating, stop the counter once before accessing to
TCRW, read the port 8 state to reflect the values of FTIOA to FTIOD output, to TOA to TOD,
and then restart the counter. Figure 13.26 shows an example when the compare match and the
bit manipulation instruction to TCRW occur at the same timing.
Compare match
signal B
φ
FTIOB pin
TCRW
write signal
Set value
Bit
TCRW
000 00110
765 43210
CCLR CKS2 CKS1 CKS0 TOD TOC TOB TOA
Expected
output
Remains high because the 1 writing to TOB has priority
TOCR has been set to H'06. Compare match B and compare match C are used.
The FTIOB pin is in the 1 output state, and is set to the toggle output or the 0 output by compare match B.
When BCLR#2, @TOCR is executed to clear the TOC bit (the FTIOC0 signal is low) and compare match B
occurs at the same timing as shown below, the H'02 writing to TOCR has priority and compare match B
does not drive the FTIOB signal low; the FTIOB signal remains high.
BCLR#2, @TCRW
(1) TCRW read operation: Read H'06
(2) Modify operation: Modify H'06 to H'02
(3) Write operation to TOCR: Write H'02
Figure 13.26 When Compare Match and Bit Manipulation Instruction to TCRW
Occur at the Same Timing










