
433
19.4
Interrupts
The timer C interrupt is generated on TCC overflow.
When TCC overflows, IFTC in the interrupt control bit area is set to 1. IFTC is never cleared
automatically, even if the interrupt is accepted. The interrupt handling routine should clear IFTC
to 0.
The timer C interrupt can be independently enabled or disabled by IMTC in the interrupt control
bit area.
19.5
Usage Notes
Keep the following points in mind when using timer C.
Be sure to write TWCL first and then TWCU when using the TWCL/U pair to initialize TCC.
The value in the TWCL/U pair is written to TCC at the point that TWCU is written. Thus if
TWCL has been set and only the value in the upper digit is to be changed, it is only necessary
to write TWCU.
However, when using PWM output with the reload timer setting (i.e., with the PMRA2 bit set
to 1 and the TMC3 bit set to 0) in HD404358, HD404358R, and HD404369 Series
microcomputers, after the TWCL/U pair has been written, the contents of the TWCL/U pair
are written to TCC when TCC overflows. Also, if only the upper digit needs to be changed,
first write TWCL and then write TWCU.
Be sure to read TRCU first and then TRCL when reading the TCC value using the TRCL/U
pair. The value in the lower digit of TCC is latched into TRCL when TRCU is read. Thus
reading TRCL returns the value of the TCC lower digit at the point TRCU was last read.
When changing the value of TMC, the new value becomes valid two instructions after the
execution of the instruction that wrote TMC. Therefore it is necessary for programs that
initialize timer C (set the reload value or initialize TCC) by writing to the TWCL/U pair to
perform this initialization only after the mode changed by TMC has become valid.
Keep the following points in mind when using the timer output as PWM output.
In PWM output mode, the duty and the period between the point when the timer write register
is updated and the point when the next overflow interrupt is generated differ from the set
values as shown in table 19-3.
Therefore, when using PWM output, only use the output following the overflow interrupt
generated after the timer write register was updated. The PWM output following the first
overflow will have the duty and period specified by the settings.