
HARDWARE CONFIGURATION
2-46
8-Bit PWM TIMER
(TIMER 1)
Operation description
(1) Timer operation
Setting the P/TX bit of the CNTR to 1, gives the timer operation mode is per-
formed. When the TPE bit of the CNTR is set to 1, the counter starts incre-
menting from 00H. When the value of the counter agrees with that of the
COMR, the counter is cleared on the next count clock pulse and starts incre-
menting. Therefore, the TIR bit is set and the output pin is reversed (when
the TPE bit is 0, the output pin is fixed to Low level) in cycles of the count
clock pulses when
00
H
is written at the COMR, or in cycles 256 times longer
than those of the count clock pulses when
FF
H
is written.
If the value of the COMR is rewritten in the timer operation mode, it becomes
effective from the next cycle. When the value of the counter is
00
H
, the value
of the COMR is transferred to the comparator latch.
Count-clock pulse
TIR bit setting
Output
TPE
00
Value of COMR
00
00
00
00
01
FF
00
FF
00
Fig. 2.23 Timer Operation
If the TIE bit of the CNTR is set to 1, an interrupt occurs when the values of
the counter and COMR agree. During interrupt processing, the TIR bit is
used as the interrupt flag. The TIR bit is set irrespective of the value of the
TIE bit. However, if the values of the counter and the COMR agree, the TIR
bit is set to 1 even after an interrupt is disabled.
Writing 0 at the TIR bit permits clearing of the interrupt source or the TIR bit.
When the Read Modify Write instruction is read, the TIR bit is set so that 1 is
always read to prevent erroneous clearing.
The count clock pulse can be selected from four clock pulses from the pres-
caler by the clock pulse select bits P0 and P1 of the CNTR.
(2) PWM operation
Setting the P/TX bit of the CNTR to 1, gives the PWM operation mode. The
COMR specifies the duty of the output pulse. Pulses can be output with
1/256 resolution and a duty of 0% to 99.6%. When 0 (
00
H
) is written at the
COMR, the duty of the PWM output pulse is 0%; when 128 (
80
H
) is written,
the duty is 50%, and when 255 (
FF
H
) is written, the duty is 99.6%.
The value of the COMR is transferred to the comparator latch when the val-
ue of the counter is
00
H
. If the value of the COMR is rewritten in the PWM
operation mode, it becomes effective from the next cycle.
Содержание F2MC-8L Series
Страница 121: ...INSTRUCTIONS 4 7 4 5 F2MC 8L FAMILY INSTRUCTION MAP ...
Страница 123: ...5 MASK OPTIONS ...
Страница 125: ...APPENDIX ...